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

update_collection_type()

Description

Update collection type for one collection or batch

Parameters

ColumnTypeDefaultDescription
$cid integer|array Collection ID -or- list of collection IDs
$type integer Collection type. @see include/definitions.php for available options

Return

boolean

Location

include/collections_functions.php lines 4242 to 4273

Definition

 
function update_collection_type($cid$type)
    {
    
debug_function_call("update_collection_type"func_get_args());

    if(!
is_array($cid))
        {
        
$cid = array($cid);
        }

    
$cid array_filter($cid"is_numeric");

    if(empty(
$cid))
        {
        return 
false;
        }

    if(!
in_array($typedefinitions_get_by_prefix("COLLECTION_TYPE")))
        {
        return 
false;
        }

    foreach(
$cid as $ref)
        {
        
collection_log($refLOG_CODE_EDITED"""Update collection type to '{$type}'");
        }

    
$cid_list "'" implode("', '"$cid) . "'";

    
sql_query("UPDATE collection SET `type` = '{$type}' WHERE ref IN ({$cid_list})");

    return 
true;
    }

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