Forum for discussing general topics related to Couch.
13 posts Page 1 of 2
Just a quick one(hopefully) haha

Is there a way to hide the users page on the admin side of couchcms for administrators so it is only viewable by the super admin as don't want administrators to be able to create user accounts and view the users page and allow them to be able to change passwords etc.

Thank you in advance
See this thread viewtopic.php?f=8&t=11547
The solution there doesn't take into account the superadmin. If you need assistance with php let me know.
Thank you for the link, appreciate it. I have had a look at it but think I would need some help with it so that the users only shows for the superadmin
You can use my adaptation of the function -
Code: Select all
    // remove certain templates for everyone except superadmin
    function my_alter_admin_menuitems( &$items ){
        global $AUTH;

        // set hidden templates -
        $tpls = array(
                    'template-to-hide.php'
                ,   'another-template-to-hide.php'
                ,   'index.php'
                ,   'users.php' // extended users template
                ,   'users'     // system 'USERS' section
        );

        // a freeway for superadmin
        if( $AUTH->user->access_level == 10 ) return;

        if( array_key_exists('_modules_', $items) ){
            unset( $items['_modules_'] ); // hide empty Administration section
        }
        foreach( $tpls as $tpl ){
            if( array_key_exists($tpl, $items) ){
                unset( $items[$tpl] );
            }
        }
    }


However, this solution has a backdoor - if administrator tries to input a direct link in the browser, such as http://example.com/couch/?o=users&q=list - then Users section will be visible. Try to also restrict it with the simple-access-control addon. Does it help?
Thank you, will try that coding. What file does that coding go in?
ianhaney50 wrote: Thank you, will try that coding. What file does that coding go in?

That's a million-dollar question.

Please read the mentioned thread - viewtopic.php?f=8&t=11547 - and also the thread linked in the first post of it.
Give it some time :)
I put the coding in the kfunctions.php file but does not do anything as reading through, it did look like it went in the kfunctions.php file
ianhaney50 wrote: I put the coding in the kfunctions.php file but does not do anything as reading through, it did look like it went in the kfunctions.php file

Keep us informed about your progress. I like it when forum got new messages :)

TLDR; yes, it goes to kfunctions.php - one in your addons folder or one in theme or one in site's root. But you must follow the instructions by @KK very very closely to put it in correct environment.

Just make sure you don't pretend to look piteous. People get help here after they studied everything and had run into some trouble and not because they cry out loud without taking care of the education. Otherwise just hire someone to take care of the things for you.
I don't get it, I follwed KK's instructions but it still shows when a admininstrator is logged in amd it made the sidebar menu collapsed and had to click on the plus sign to see the templates in the sidebar

I think I will leave it for the time being
@KK posted full code. I posted the part that needs to be changed. Is this giving any trouble?
13 posts Page 1 of 2