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

get_default_archive_state()

Description

Get the default archive state for new resources

Parameters

ColumnTypeDefaultDescription
$requestedstate integer "" (optional) ID of requested archive state

Return

integer ID of valid user requested archive state, may differ from that requested

Location

include/resource_functions.php lines 7207 to 7241

Definition

 
function get_default_archive_state($requestedstate "")
    {
    global 
$override_status_default;

    if ((string)(int)
$requestedstate == (string)$requestedstate && checkperm("e" $requestedstate))
        {
        return 
$requestedstate;
        }

    
$modified_defaultstatus hook("modifydefaultstatusmode");
    if (
$modified_defaultstatus !== false)
        {
        
# Set the modified default status
        
return $modified_defaultstatus;
        }
    elseif (
$override_status_default !== false)
        {
        
# Set the default status if set in config.
        
return $override_status_default;
        }
    elseif (
checkperm("c") && checkperm("e0"))
        {
        
# Set status to Active
        
return 0;
        }
    elseif (
checkperm("d") && !checkperm('e-2') && checkperm('e-1'))
        {
        
# Set status to 'pending review' if the user has only edit access to Pending review
        
return -1;
        }
    else
        {
        return -
2;
        }
     }

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