Collections functions
General functions
Render functions
Theme permission functions
Resource functions

get_user_requests()

Description

Fetch a list of all requests for a user

Parameters

ColumnTypeDefaultDescription
$excludecompleted boolean false Exclude requests that have already been completed
$returnsql mixed false Return the SQL for the execution rather than the results

Return

void

Location

include/request_functions.php lines 36 to 50

Definition

 
function get_user_requests($excludecompleted=false,$returnsql=false)
    {
    global 
$userref;
    if (!
is_numeric($userref)){ return false; }

    
$query_spec = new PreparedStatementQuery();
    
$query_spec->parameters=array("i",$userref);
    
$query_spec->sql="select u.username,u.fullname,r.*,if(collection.ref is null,'0',collection.ref) collection_id, 
            (select count(*) from collection_resource cr where cr.collection=r.collection) c 
        from request r 
        left outer join user u on r.user=u.ref 
        left join collection on r.collection = collection.ref 
        where r.user = ?" 
. ($excludecompleted?" AND status<>2":"") . " order by ref desc";
    return 
$returnsql $query_spec ps_query($query_spec->sql$query_spec->parameters);
    }

This article was last updated 26th June 2022 02:05 Europe/London time based on the source file dated 1st June 2022 12:35 Europe/London time.