Collections functions
General functions
Node functions
Render functions
Theme permission functions
User 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 314 to 350

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 19th March 2024 09:35 Europe/London time based on the source file dated 15th March 2024 17:00 Europe/London time.