Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

show_hide_collection()

Description

Hide or show a collection from the My Collections area.

Parameters

ColumnTypeDefaultDescription
$colref integer
$show boolean true Show or hide?
$user integer ""

Return

void

Location

include/collections_functions.php lines 2900 to 2932

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
        {
        
//Get hidden collections for user
        
$hidden_collections=explode(",",sql_value("select hidden_collections from user where ref='" escape_check($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((
$key array_search($colref$hidden_collections)) === false
            {
            
$hidden_collections[]=$colref;
            }
        }
    
sql_query("update user set hidden_collections ='" implode(",",$hidden_collections) . "' where ref='" escape_check($user) . "'");
    }

This article was last updated 30th November 2020 17:35 Europe/London time based on the source file dated 30th November 2020 16:50 Europe/London time.