Collections functions
General functions
Render functions
Theme permission functions
Resource functions

update_resource_type()

Parameters

ColumnTypeDefaultDescription
$ref
$type

Location

include/resource_functions.php lines 3969 to 3983

Definition

 
function update_resource_type($ref,$type)
    {
    if (
checkperm("XU" $type))
        {
        return 
false;
        }


    
ps_query("UPDATE resource SET resource_type = ? WHERE ref = ?",["i",$type,"i",$ref]);

    
# Clear data that is no longer needed (data/keywords set for other types).
    
ps_query("DELETE FROM resource_node WHERE resource = ? and node>0 AND node NOT IN (SELECT n.ref FROM node n LEFT JOIN resource_type_field rf ON n.resource_type_field=rf.ref WHERE rf.resource_type = ? OR rf.resource_type=999 OR resource_type=0)",["i",$ref,"i",$type]);

    return 
true;
    }

This article was last updated 3rd October 2022 11:35 Europe/London time based on the source file dated 30th September 2022 14:20 Europe/London time.