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

process_config_options()

Description

Process configuration options from database either system wide, user group or user specific, setting the global variable.
Three modes are possible: array() - Supply an empty array to load system config values.
array('user' => 1) - Supply 'user' with the integer user reference to load user config values.
array('usergroup' => 2) - Supply 'usergroup' with the integer user reference to load user group config values.
Note: Supplying both 'user' and 'usergroup' is invalid.
In some scenarios, calling this function twice will be required e.g. load user group config then override with user config.
Note: calling this function will not revert user preferences applied previously e.g. during initialisation as a different user.
If the current user's preferences shouldn't be shown, consider using $system_wide_config_options to reapply selected system values.

Parameters

ColumnTypeDefaultDescription
$config_type: array array; // If the user doesn't have the ability to set his/her own preferences
don't then
$config_type array Specify the type of config to be loaded. See details above.

Location

include/config_functions.php lines 497 to 519

Definition

 
function process_config_options(array $config_type): void
{
    global 
$user_preferences;
    
$config_options = array();

    
// If the user doesn't have the ability to set his/her own preferences, then don't load it either
    
if (isset($config_type['user']) && !$user_preferences) {
        return;
    }

    if (
get_config_options($config_type$config_options)) {
        foreach (
$config_options as $config_option) {
            
$param_value $config_option['value'];

            
// Prepare the value since everything is stored as a string
            
if (is_numeric($param_value) && '' !== $param_value) {
                
$param_value = (int) $param_value;
            }

            
$GLOBALS[$config_option['parameter']] = $param_value;
        }
    }
}

This article was last updated 30th April 2025 21:35 Europe/London time based on the source file dated 25th April 2025 15:15 Europe/London time.