Sign in to follow this  
Followers 0

Wordpress user permissions

4 posts in this topic

Posted

Hi guys. I have a question about the admin section of Wordpress. Is it possible to limit the menu sections that a user has access to? For example, I want to define a user that sees only the Pages, Articles and Media menu links (or whatever I choose for hime), everything else should be hidden. I've read somewhere that this can be done by adding a piece of code to some file, but I am looking for some plugin that does this (if there is such a thing).

 

Thanks :)

Share this post


Link to post
Share on other sites

Posted

Hi guys. I have a question about the admin section of Wordpress. Is it possible to limit the menu sections that a user has access to? For example, I want to define a user that sees only the Pages, Articles and Media menu links (or whatever I choose for hime), everything else should be hidden. I've read somewhere that this can be done by adding a piece of code to some file, 

That would be the functions.php file in your theme folder.

 

 

but I am looking for some plugin that does this (if there is such a thing).

 

Thanks  :)

Why not write your own?

The code is simple enough:

<?php
/*
Plugin Name: Remove dashboard menus
Description: Who needs a description?
Version: 1.0
Author: TDT
Author URI: http://neowin.net
*/

    add_action( 'admin_menu', 'my_remove_menu_pages' );

    function my_remove_menu_pages() {
        remove_menu_page('link-manager.php'); //this is the remove menu item function, just change to whichever you want to remove.
        remove_menu_page('tools.php');           
    }
?>

Then you could wrap the above in an if statement to check user roles. Such as making it specific to subscribers:

$current_user = wp_get_current_user();
if (user_can($current_user, 'subscriber')) {
// enter above actions here to affect subscribers only
}

Share this post


Link to post
Share on other sites

Posted

Thank you for your answer. It doesn't work, unfortunately. I can't activate the "plugin", I get an error right at the "function...." line. :(

Share this post


Link to post
Share on other sites

Posted

Thank you for your answer. It doesn't work, unfortunately. I can't activate the "plugin", I get an error right at the "function...." line. :(

Works perfectly for me.

Do you want to post your code so we can have a look?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.