Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
It's possible to disable creating users for all roles beside Super Admin please? I mean, hide create button on Users page. I tryed this: viewtopic.php?f=4&t=8424 buth I am not found what i must overwrite or add.

Please, help.
Please paste the following in your 'addons/kfunctions.php' file (if the file does not exist, rename the 'sample' file to this) -
Code: Select all
/*
    Remove 'Add new' button from 'Users' section for everyone except super-admins
*/
$FUNCS->add_event_listener( 'alter_pages_list_toolbar_actions', 'my_remove_add_user_btn' );
$FUNCS->add_event_listener( 'alter_pages_form_toolbar_actions', 'my_remove_add_user_btn' );
function my_remove_add_user_btn( &$arr_actions ){
    global $AUTH, $FUNCS;

    $route = $FUNCS->current_route;
    if( $route->module=='users' ){
        if( $AUTH->user->access_level < '10' ){ // if not a super-admin
            // remove 'Add new user' button from toolbar
            if( array_key_exists('create_new', $arr_actions) ){
                unset( $arr_actions['create_new'] )  ;
            }
        }
    }

}

Hope it helps. Please let me know.
Thanks a lot. It's work.
3 posts Page 1 of 1