Collections functions
General functions
Render functions
Theme permission functions
Resource functions

get_tracked_vars()

Description

Get all tracked variables (for debug) for user. If user invalid, it will get all the variables currently being tracked
by all users.

Parameters

ColumnTypeDefaultDescription
$user int User ID

Return

array List of variable names

Location

include/debug_functions.php lines 169 to 202

Definition

 
function get_tracked_vars(int $user)
    {
    global 
$tracked_var_cache;
    if(isset(
$tracked_var_cache[$user]))
        {
        return 
$tracked_var_cache[$user];
        }
    if(
$user 0)
        {
        
$vars_csv get_sysvar("track_var_{$user}"'');
        
$vars_list explode(',', (string) $vars_csv);
        
$vars_trimmed array_map('trim'$vars_list);
        
$vars_not_empty array_filter($vars_trimmed);
        
        
$return array_values(array_unique($vars_not_empty));
        
$tracked_var_cache[$user] = $return;
        return 
$return;
        }

    
$all_tracked_vars = [];
    
$all_users_tracked_vars ps_array("SELECT `value` FROM sysvars WHERE `name` REGEXP '^track_var_[[:digit:]]+$'",array());
    foreach(
$all_users_tracked_vars as $vars_csv)
        {
        
$vars_list explode(','$vars_csv);
        
$vars_trimmed array_map('trim'$vars_list);
        
$vars_not_empty array_filter($vars_trimmed);

        
$all_tracked_vars array_merge($all_tracked_vars$vars_not_empty);
        }

    
$return array_values(array_unique($all_tracked_vars));
    
$tracked_var_cache[$user] = $return;
    return 
$return;
    }

This article was last updated 2nd October 2022 18:05 Europe/London time based on the source file dated 28th June 2022 15:27 Europe/London time.