Collections functions
General functions
Node functions
Render functions
Theme permission functions
User 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 5303 to 5335

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}'");
            }
        }

    
ps_query("UPDATE collection SET `type` = ? WHERE ref IN ("ps_param_insert(count($cid)) .")"array_merge(['i'$type], ps_param_fill($cid'i')));

    return 
true;
    }

This article was last updated 25th April 2024 11:05 Europe/London time based on the source file dated 19th April 2024 15:45 Europe/London time.