Support » Developing with WordPress » Create a plugin administration menu accessible for non admins(authors/editors)

  • Resolved howofr



    Let’s say I have a plugin that adds a custom text at the end of posts (it’s not what my plugin does but it’s to give you a simpler example). And I want each author to be able to set whatever text they want.

    Currently the way I do this is I have an admin menu where admins can specify what custom text each author want. But authors can’t set it themselves since they don’t have access to that menu.

    I looked up and a bit around the admin_menu hook but I haven’t found a way to set a plugin menu with unique settings for each user that has the author or editor role.

    So is it possible ? And if so how can I do it ?

    Thanks in advance !

    • This topic was modified 1 year, 1 month ago by howofr.
    • This topic was modified 1 year, 1 month ago by howofr.
Viewing 6 replies - 1 through 6 (of 6 total)
  • If the details are unique to each author, I’d set up extra fields in the users profile area. That way they can update those when they update their profile information, it is already set on a “per user” basis, and it’s a whole lot easier than trying to add in extra menu items and custom work.

    Moderator bcworkz


    Profile area additions will work fine. Another option if you prefer a separate admin menu item that authors or above can access, you can use add_menu_page() where an author capability can be specified to allow visibility. The function that generates your admin page can get the current field value from the current user’s meta data. It can also check if new data is in $_REQUEST and save it to user meta after properly sanitizing and validating the input.

    Do not use the Settings API as suggested in the Administration Menus page you were looking at because those values go to the options table. You need to manage per user settings yourself.


    Thanks a lot for your answers ! Is using the profile area secure though ? I will store some relatively sensitive information. It should only be viewable by the author. It’s not an issue if the admin can see it but if any other role it is.

    Best regards

    Using profile is probably more secure then some other methods (bcworkz one will work fine though) because standard users can’t see or interact with other users profile editing pages so they won’t be able to see any of the extra details.

    Awesome thanks ! I’ll try it out tomorrow.

    And it works perfectly. I went for the user profile solution in the end. Thanks a lot guys !

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Create a plugin administration menu accessible for non admins(authors/editors)’ is closed to new replies.