Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

create_resource_type()

Description

Create a new resource type with the specified name

Parameters

ColumnTypeDefaultDescription
$name
Name $name of new resouce type

Return

int| bool ref of new resource type or false if invalid data passed

Location

include/config_functions.php lines 1521 to 1536

Definition

 
function create_resource_type($name)
    {
    if(!
checkperm('a') || trim($name) == "")
        {
        return 
false;
        }

    
ps_query("INSERT INTO resource_type (name) VALUES (?) ",array("s",$name));
    
$newid sql_insert_id();
    
clear_query_cache("schema");
    if(isset(
$GLOBALS["restype_cache"]))
        {
        unset(
$GLOBALS["restype_cache"]);
        }
    return 
$newid;
    }

This article was last updated 29th May 2024 10:35 Europe/London time based on the source file dated 23rd May 2024 18:05 Europe/London time.