Jump to content



Photo

Wordpress user permissions


  • Please log in to reply
3 replies to this topic

#1 TDT

TDT

    Hey yo!

  • Tech Issues Solved: 2
  • Joined: 17-March 10
  • Location: Bucharest, Romania

Posted 18 August 2013 - 23:15

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 :)




#2 the better twin

the better twin

    Neowinian Senior

  • Tech Issues Solved: 2
  • Joined: 26-January 10
  • OS: Win 8
  • Phone: Nokia Lumia

Posted 19 August 2013 - 08:40

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
}


#3 OP TDT

TDT

    Hey yo!

  • Tech Issues Solved: 2
  • Joined: 17-March 10
  • Location: Bucharest, Romania

Posted 25 August 2013 - 20:56

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. :(



#4 the better twin

the better twin

    Neowinian Senior

  • Tech Issues Solved: 2
  • Joined: 26-January 10
  • OS: Win 8
  • Phone: Nokia Lumia

Posted 27 August 2013 - 09:23

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?