Collections functions
General functions
Render functions
Theme permission 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
$log true

Return

boolean

Location

include/collections_functions.php lines 4989 to 5023

Definition

 
function update_collection_type($cid$type$log true)
    {
    
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;
        }

    if(
$log)
        {
        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 25th May 2022 05:05 Europe/London time based on the source file dated 17th May 2022 15:20 Europe/London time.