Add this sample to kfunctions.php:
Code: Select all

// Create a variable for debug
$FUNCS->add_event_listener( 'add_render_vars', 'add_my_vars' );
function add_my_vars(){
    global $CTX, $AUTH;
    if( $AUTH->user->access_level >= K_ACCESS_LEVEL_SUPER_ADMIN ){
        $CTX->set( 'is_superadmin', 1, 'global' );

This code creates a global variable 'is_superadmin' for all templates via 'add_render_vars' hook.
This sample can be changed to add your own variable if you are smart enough not to add it in each template manually :)