Collections functions
General functions
Render functions
Theme permission functions
Resource functions

get_config_option()

Description

Get config option from database

this parameter which is passed by reference
global setting e.g. for checking admin resource preferences

Parameters

ColumnTypeDefaultDescription
$user_id integer Current user ID
$name string Parameter name
&$returned_value
$default mixed null Optionally used to set a default that may not be the current
$returned_value string If a value does exist it will be returned through

Return

boolean

Location

include/config_functions.php lines 177 to 210

Definition

 
function get_config_option($user_id$name, &$returned_value$default null)
    {
    if(
trim($name) === '')
        {
        return 
false;
        }

    if(
is_null($user_id))
        {
        
$user_query 'user IS NULL';
        }
    else    
        {
        
$user_query 'user = ?';
        
$params[] = 'i'$params[] = $user_id;
        }

    
$query "SELECT `value` FROM user_preferences WHERE "$user_query ." AND parameter = ?";
    
$params[] = "s"$params[] = $name;
    
$config_option ps_value($query,$paramsnull);
    if(
is_null($default) && isset($GLOBALS['system_wide_config_options'][$name]))
        {
        
$default $GLOBALS['system_wide_config_options'][$name];
        }

     if(
is_null($config_option))
        {
        
$returned_value = isset($default) ? $default null;
        return 
false;
        }

    
$returned_value unescape($config_option);
    return 
true;
    }

This article was last updated 3rd October 2022 13:05 Europe/London time based on the source file dated 26th August 2022 16:20 Europe/London time.