The MU forums have moved to WordPress.org

Can I restrict the access to admin pages? (19 posts)

  1. kirilius
    Member
    Posted 16 years ago #

    It seems WordPress-MU gives admin privileges to any new-registered user. That includes themes, blogs, options... everything.

    What I want is a centralized administration available only to the admin user. New users will be given ONE blog and will have control on its contents only.

    Is that possible with WP-MU?

  2. drmike
    Member
    Posted 16 years ago #

    New users will be given ONE blog and will have control on its contents only.

    That how wpmu works. A user signs up and they have control over their blog. Nothing more. The site admin has control over everything.

    The one blog bit would be a bit toughter as it's hard coded to allow multiple blogs. Could have sworn someone had posted a work around for this. Anyone remember it?

    I would think doing a check against get_users_blogs(); to get a count and disallowing another signup would be best.

  3. kirilius
    Member
    Posted 16 years ago #

    The thing is that newly-registered users get not only one blog. They also get control over themes, settings, plugins, etc. This is what I want to restrict.

  4. kirilius
    Member
    Posted 16 years ago #

    Can this be done with WordPress MU?

  5. lunabyte
    Member
    Posted 16 years ago #

    Yes, it can. Not out of the box, so you'll have to modify it in one fashion or another. How you go about it is up to you.

  6. andrea_r
    Moderator
    Posted 16 years ago #

    New users who sign up get admin privs on *just* their own blog, no-one else's.
    You could restreict the amount of themes & plugins availble to them by just not having them.

    It sounds like what you want is one blog with many users almost?

  7. drmike
    Member
    Posted 16 years ago #

    You would have to edit the wp-includes/upgrade-schema.php file and modify the different levels of access provided to the different role levels. It's fairly readable (ie addoption("edit_pages"); ) so it shouldn't be too hard to do. May require some testing though on your part.

  8. jaredbangs
    Member
    Posted 16 years ago #

    I believe that you can do what you want via a plugin or a hack to the MU files, whichever method you prefer.

    There are several spots in the registration process that have "hooks" for plugins, at which point you could do things like change the user level of that user back down to an Author (or whatever suits your needs) and also check to make sure they don't have any other blogs registered, and not allow more than one to be created.

    Like everyone else has suggested, though, this would be a pretty significant change to the default functionality, so just be aware that once you start making those kinds of significant changes that things may work differently in some areas than you'd expect, and it might be harder to find support if something goes wrong. That being said, if you know what you're doing enough to not worry about that, then go for it!

  9. Ovidiu
    Member
    Posted 16 years ago #

    whats wrong here?

    the last 5 relies seem empty to me?

  10. lunabyte
    Member
    Posted 16 years ago #

    Donncha must be picking on you, and put in a special clause to hide text from you just to make you go coo-coo. :D

    Seriously, beats me. Looks ok to me.

  11. drmike
    Member
    Posted 16 years ago #

    Looks fine to me as well. what browser and version are you using?

  12. Ovidiu
    Member
    Posted 16 years ago #

    hmm.. strange...
    using firefox, latest version at the time of posting.
    also that "bug" was just appearing when browsing from home. I'll check again later this day but I remember having seen this effect before => mostly with lunabytes posts (I just thought his tongue might have slipped a little and Donncha censured his posts ;-) hehe luna

    But seriously, I encountered that before, seeing some replies without any content....I'll double check my adblock settings at home later today

  13. MIW54
    Member
    Posted 16 years ago #

    You could use something like this to prevent everyone else but the admin to see the plugins options in admin menu.

    In wp-admin/menu.php, find:

    //$submenu['plugins.php'][5] = array(__('Plugins'), 'activate_plugins', 'plugins.php');
    //$submenu['plugins.php'][10] = array(__('Plugin Editor'), 'edit_plugins', 'plugin-editor.php');

    and replace it with:

    get_currentuserinfo();
    if( is_site_admin() ) {
    //$submenu['plugins.php'][5] = array(__('Plugins'), 'activate_plugins', 'plugins.php');
    //$submenu['plugins.php'][10] = array(__('Plugin Editor'), 'edit_plugins', 'plugin-editor.php');
    }

    Remember to make notes of all the modifications you make!

  14. donncha
    Key Master
    Posted 16 years ago #

    A better way of doing that is by using the _admin_menu action to filter the menu array in a plugin.
    It's an action, not a filter, so you'll have to "global $menu" but it's a simple job then of running through the menu items and getting rid of what shouldn't be shown.

    kirilius - going back to your original question, it should be easy to change the default role of new users to something like editor or contributor. I'm not sure what action to use off the top of my head.

  15. drmike
    Member
    Posted 16 years ago #

    It does it all! Has more uses than a housewife with a 10 in 1 tool! It's in my favorite file and yours:

    wp-includes/wpmu-functions.php

    Line 1251

    Assign the correct role level.

    *sigh* Is there anything wpmu-functions.php can't do? ;)

  16. lunabyte
    Member
    Posted 16 years ago #

    Well Doc, it can't make me coffee yet, but after all the midnight ups and downs I bet Donncha's working on it. :D

    What confuses me, is why not let users change their theme? If you only want 1 theme across all sites, then just have 1 theme in the themes directory.

    Then again, if it's something where you want it all set up a certain way, and not touched (including permalinks and whatever), I could see the need to make them an editor instead, and then editing upgrade schema to set the settings how you want them.

  17. drmike
    Member
    Posted 16 years ago #

    You've lost me. Are you trying to get editors to be able to change their themes? Should just have to add in that access to the list of what an editor can do in the upgrade-schema.php file.

  18. lunabyte
    Member
    Posted 16 years ago #

    No, they want to keep blog owners from changing themes and (apparently) other admin settings for their individual blog.

  19. drmike
    Member
    Posted 16 years ago #

    Easiest way to do it is to edit those role permissions in upgrade-schema.php

About this Topic