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

show_hide_collection()

Parameters

ColumnTypeDefaultDescription
$colref
$show true
$user ""

Location

include/collections_functions.php lines 3941 to 3978

Definition

 
function show_hide_collection($colref$show=true$user="")
    {
    global 
$userref;
    if(
$user=="" || $user==$userref)
        {
        
// Working with logged on user, use global variable 
        
$user=$userref;
        global 
$hidden_collections;
        }
    else
        {
        if(!
checkperm_user_edit($user))
            {
            return 
false;
            }
        
//Get hidden collections for user
        
$hidden_collections=explode(",",ps_value("SELECT hidden_collections FROM user WHERE ref=?",array("i",$user), ""));
        }
        
    if(
$show)
        {
        
debug("Unhiding collection " $colref " from user " $user);
        if((
$key array_search($colref$hidden_collections)) !== false)
            {
            unset(
$hidden_collections[$key]);
            }
        }
    else
        {
        
debug("Hiding collection " $colref " from user " $user);
        if(
array_search($colref$hidden_collections) === false
            {
            
$hidden_collections[]=$colref;
            }
        }
    
ps_query("UPDATE user SET hidden_collections = ? WHERE ref= ?", ['s'implode(','$hidden_collections), 'i'$user]);
    return 
true;
    }

This article was last updated 17th November 2024 15:05 Europe/London time based on the source file dated 13th November 2024 15:50 Europe/London time.