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_config_options()

Description

Get config option from database for a specific user or system wide

this parameter which is passed by reference

Parameters

ColumnTypeDefaultDescription
$user_id integer Current user ID. Can also be null to retrieve system wide config options
&$returned_options array
$returned_options array If a value does exist it will be returned through

Return

boolean

Location

include/config_functions.php lines 315 to 351

Definition

 
function get_config_options($user_id, array &$returned_options)
    {
    
$params = [];
    if(
is_null($user_id))
        {
        
$sql 'user IS NULL';
        }
    else
        {
        
$sql 'user = ?';
        
$params = ['i'$user_id];
        }

    
$query 'SELECT parameter, `value` FROM user_preferences WHERE ' $sql;
    
$config_options ps_query($query$params,"preferences");

    if(empty(
$config_options))
        {
        return 
false;
        }

    
// Strip out any system configs that are blocked from being edited in the UI that might have been set previously.
    
global $system_config_hide;
    if (
is_null($user_id) && count($system_config_hide)>0)
        {
        
$new_config_options=array();
        for(
$n=0;$n<count($config_options);$n++)
            {
            if (!
in_array($config_options[$n]["parameter"],$system_config_hide)) {$new_config_options[]=$config_options[$n];} // Add if not blocked
            
}
        
$config_options=$new_config_options;
        }

    
$returned_options $config_options;

    return 
true;
    }

This article was last updated 4th December 2024 09:05 Europe/London time based on the source file dated 13th November 2024 15:50 Europe/London time.