Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video 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 6716 to 6750

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 3rd December 2020 13:05 Europe/London time based on the source file dated 30th November 2020 11:55 Europe/London time.