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 5189 to 5221

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 30th September 2022 17:35 Europe/London time based on the source file dated 22nd September 2022 11:00 Europe/London time.