Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource 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 244 to 276

Definition

 
function get_config_options($user_id, array &$returned_options)
    {
    
$query sprintf('
            SELECT parameter,
                   `value`
              FROM user_preferences
             WHERE %s;
        '
,
        
is_null($user_id) ? 'user IS NULL' 'user = \'' escape_check($user_id) . '\''
    
);
    
$config_options sql_query($query,"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 23rd November 2020 19:05 Europe/London time based on the source file dated 6th October 2020 10:25 Europe/London time.