Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

get_user_requests()

Description

Fetch a list of all requests for a user

Parameters

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

Return

mixed

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 19th March 2024 08:35 Europe/London time based on the source file dated 28th February 2024 10:20 Europe/London time.