Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

get_session_collections()

Description

Get an array of collection IDs for the specified ResourceSpace session and user

Parameters

ColumnTypeDefaultDescription
$rs_session string Session id - as obtained by get_rs_session_id()
$userref integer "" User ID
$create boolean false Create new collection?

Return

array Array of collection IDs for the specified sesssion

Location

include/collections_functions.php lines 3704 to 3724

Definition

 
function get_session_collections($rs_session$userref ""$create false)
{
    
$extrasql "";
    
$params = array("s",$rs_session);
    if (
$userref != "") {
        
$extrasql "AND user=?";
        
$params[] = "i";
        
$params[] = $userref;
    } else {
        
$userref 'NULL';
    }
    
$collectionrefs ps_array("SELECT ref value FROM collection WHERE session_id=? AND type IN ('" COLLECTION_TYPE_STANDARD "','" COLLECTION_TYPE_UPLOAD "','" COLLECTION_TYPE_SHARE_UPLOAD "') " $extrasql$params"");
    if (
count($collectionrefs) < && $create) {
        if (
upload_share_active()) {
            
$collectionrefs[0] = create_collection($userref"New uploads"010false, array("type" => 5)); # Do not translate this string!
        
} else {
            
$collectionrefs[0] = create_collection($userref"Default Collection"01); # Do not translate this string!
        
}
    }
    return 
$collectionrefs;
}

This article was last updated 17th March 2025 20:35 Europe/London time based on the source file dated 11th March 2025 11:35 Europe/London time.