Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

add_collection()

Description

Add a collection to a user's 'My Collections'

Parameters

ColumnTypeDefaultDescription
$user integer ID of user
$collection integer ID of collection

Return

void

Location

include/collections_functions.php lines 802 to 815

Definition

 
function add_collection($user,$collection)
    {
    
// Don't add if we are anonymous - we can only have one collection
    
global $anonymous_login,$username,$anonymous_user_session_collection;
     if (isset(
$anonymous_login) && ($username==$anonymous_login) && $anonymous_user_session_collection)
        {return 
false;}
    
    
# Remove any existing collection first
    
remove_collection($user,$collection);
    
# Insert row
    
sql_query("insert into user_collection(user,collection) values ('" escape_check($user) . "','" escape_check($collection) . "')");
    
#log this
    
collection_log($collection,"S",0sql_value ("select username as value from user where ref = '" escape_check($user) . "'",""));
    }

This article was last updated 11th July 2020 22:05 Europe/London time based on the source file dated 9th July 2020 17:22 Europe/London time.