The MU forums have moved to WordPress.org

Limiting user admin capabilities (33 posts)

  1. Miroslav
    Member
    Posted 15 years ago #

    I want to limit my user admins from performing certain actions that are not part of the standard Roles_And_Capabilities.

    For example, don't want them to be able to: use Import/Export, Delete the Blog, modify Permalinks, etc.

    How do I do it? Is there a plugin that allows this (I looked at Role Manager, but it seems to be doing only the standard Roles_And_Capabilities stuff).

    Thanks in advance!

  2. dsader
    Member
    Posted 15 years ago #

    I removed Import/Export, Delete the Blog, modify Permalinks, etc." via the menus rather than the caps/roles.

    I use a wpmudev.org Menus plugin which removes the menu and redirects a url request for Import/Export and Permalinks while "Delete Blog" gets a "remove_action", so it is gone completely.

  3. Miroslav
    Member
    Posted 15 years ago #

    Thanks, dsader. Will check it out! :)

  4. Miroslav
    Member
    Posted 15 years ago #

    Hi dsader,

    I checked out the Menus plugin. Works great, thanks!

    My only remaining issue is how to remove menu items related to certain plugins (e.g. Domain Mapping)? Would I need to modify individual plugin files? Or, can the Menus plugin take care of this, too?

    Thanks! :)

    *** Edit: Also, how do I get rid of the Widgets link in Design? ***

  5. dsader
    Member
    Posted 15 years ago #

    Widgets Menu? I gave up. It isn't added the same way as the rest.

    Plugins have their own add menu bits. I'd deal with it there.

  6. boonika
    Member
    Posted 15 years ago #

    Miroslav, where are you from?
    @others, sorry for asking these kind of questions here:)

  7. Miroslav
    Member
    Posted 15 years ago #

    @ dsader - thanks! :)

    @ boonika - I'm from Slovakia, but live in Hungary

  8. boonika
    Member
    Posted 15 years ago #

    A lot of Miroslavs here in Croatia... Hungary? Than we are neighbors;)

    Cheers

  9. boonika
    Member
    Posted 15 years ago #

    @dsader

    Is it possible to disable/enable menus only for some blogs?

  10. dsader
    Member
    Posted 15 years ago #

    Boonika, put any menu plugin in normal "plugins" then use Plugin Commander to pick which blogs get it.(my plugin would cause all blogs still get same setting, though).

  11. boonika
    Member
    Posted 15 years ago #

    Dsader, I'm already using something similar. Using your (old) hide menu solution (that you provided before you wrote this plugin) in combination with Plugin Commander.

    Still, this plugin is easier to use so I believe you'll add that feature in the future cause more and more people will want it. Somewhere under Manage Menu. I'll be waiting:)

  12. boonika
    Member
    Posted 15 years ago #

    @dsader

    Maybe some functions from here could help you expand the plugin in good direction... or not. You're the expert.

    http://wordpress.org/extend/plugins/wp-cms-post-control

    I already pasted this link back at wpmu.org but... bigmouth strikes again.

  13. indojepang
    Member
    Posted 15 years ago #

    I already pasted this link back at wpmu.org but... bigmouth strikes again.

    forgive boonika dsader.. but i really like her spirit! :P

  14. gemanshi
    Member
    Posted 15 years ago #

    So I think the Menus plugin will do what I want. That is, I want to hide all the admin menu from everyone but the admin leaving only the dashboard and the profile page.

    That being said, I'm getting an error I've noticed a couple other people are getting. The following appears at the top of the login screen after I login under various test user accounts. Aside from these errors showing up it does work so I'm SOOO close. Thanks for this great plugin.

    Warning: Invalid argument supplied for foreach() in /home/grant237/public_html/wp-content/plugins/592867123_ds_toggle_admin_menus_13.php on line 149

    Warning: Invalid argument supplied for foreach() in /home/grant237/public_html/wp-content/plugins/592867123_ds_toggle_admin_menus_13.php on line 160

    Warning: Invalid argument supplied for foreach() in /home/grant237/public_html/wp-admin/menu.php on line 84

    I deleted all the other plugins to make sure it's not colliding with other plugins. Any help would be greatly appreciated.

  15. andrea_r
    Moderator
    Posted 15 years ago #

    I ran into this exact same error recently, but using a different variation of this plugin.

    Basically it needs an if statement around some sections, because you can't remove access to menus that certain levels don't see anyway. :)

    For example, editors can't see the plugin menu anyway.

  16. gemanshi
    Member
    Posted 15 years ago #

    That makes sense. Now the big question, did you come up with an if statement to plug in? Love to see it if so. I'll try messing with it but I'm pretty sure I'm going to be increasing the errors ;-)

  17. MrBrian
    Member
    Posted 15 years ago #

    They are just warnings so if it isn't causing any issues, just wait for an update :).

  18. gemanshi
    Member
    Posted 15 years ago #

    That would work but I'd prefer end-users not see them. They might freak out ;-) Or at least, the neat freak in me does.

  19. dsader
    Member
    Posted 15 years ago #

    andrea_r's got the issue pegged. I never paid any attention the the role/caps of anyone other than SiteAdmin/Blog admin in my testing. Back to the drawing board. Jeez, I'll be seeing those errors soon when school starts next week, too. Maybe I'll have time to revisit this plugin before then, but summer's free time is gone. I'd like it to work, just don't know when, yet.

  20. MrBrian
    Member
    Posted 15 years ago #

    Gemanshi,

    If your site is live, you should turn error_reporting off in your PHP settings. Not doing so is a minor security risk and yes, unattractive to your visitors when they do see such errors :).

  21. boonika
    Member
    Posted 15 years ago #

    @indojepang - it is 'he':)... but thanks for your compliment.

  22. andrea_r
    Moderator
    Posted 15 years ago #

    When I said I ran into it recently, it was the day before. :D Drove me NUTS. Also, I was head-fuzzy because I'd been at the dentist who drilled a hole in my head, but my patient hubby helped me find it.

    We picked the admin capability, and wrapped an if around the menu items only they could see, like so:

    if ($the_user->has_cap('switch_themes') ) {

    then remove these menus

    end if.

  23. gemanshi
    Member
    Posted 15 years ago #

    MrBrian, thanks for the input.

    AndreaR, thank you as well. Hope your tooth/head feels better. I'm going to get on this now.

    Thanks!

  24. dsader
    Member
    Posted 15 years ago #

    I'm going to use the format from within the menu.php:
    if(current_user_can('switch_themes')

  25. andrea_r
    Moderator
    Posted 15 years ago #

    "I'd been at the dentist who drilled a hole in my head, but my patient hubby helped me find it."

    Wow, what bad grammar I have. :D He helped me find the error, not the hole in my head. :D

    - dsader - yep, that should do it. ours was written slightly differently.

  26. MrBrian
    Member
    Posted 15 years ago #

    Speaking of dentists - I'm getting braces put on tomorrow. They are going to enhance my "coolness" and hopefully align my teeth to utter perfection over 2 years and an empty wallet. </sarcasm>

  27. indojepang
    Member
    Posted 15 years ago #

    @MrBrian: Lol :)) luckily i don't give a dame about my look.. so my wallet still keep intact!

    @Boonika: ups sorry! (i though Boonika means =Grandma)
    ‘Boonika Bate Doba’ (‘Grandma Beats The Drum’)

  28. dsader
    Member
    Posted 15 years ago #

    The menu plugin is updated. Your feedback was appreciated. If any would like to test again, leave another comment at http://wpmudevorg.wordpress.com/project/Menus.

  29. boonika
    Member
    Posted 15 years ago #

    Danke

  30. phlux0r
    Member
    Posted 15 years ago #

    A note about using this (fantastic) plugin with BuddyPress: BuddyPress changes the Settings menus and introduces a third level of navigation so this plugin doesn't work properly.

    Also, the Delete Blog menu gets disabled, no matter what. I'm aware it states that in the comment at the beginning but the reason it's disabled is that when the plugins_loaded action is executed, the $current_user variable is undefined so, the logic in the function doesn't work (even when I tried to override it as using is_site_admin() doesn't work). I simply moved the action to _admin_menu instead...

About this Topic

  • Started 15 years ago by Miroslav
  • Latest reply from selcyis