Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test 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 7444 to 7478

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 17th November 2024 15:05 Europe/London time based on the source file dated 15th November 2024 18:30 Europe/London time.