WordPress.org

Forums

Quick Page/Post Redirect Plugin
Hide the Redirect Menu for lower lever users? (12 posts)

  1. whenis
    Member
    Posted 3 years ago #

    Hi, great plugin!

    I'd like to hide the redirect menu/box for any user other than the high-level admin. is this possible?

  2. prophecy2040
    Member
    Plugin Author

    Posted 3 years ago #

    whenis -
    This did not make it in the new version 4.2.2 I released today, but I do have it in development for the next version.

    Thanks again for the feedback.
    Don

  3. b33fheart
    Member
    Posted 3 years ago #

    Hi -- great plugin thanks.

    Unfortunately going to have to uninstall it though. I have a multi user site and it needs to be idiot proof. I cannot have the redirect menu showing for low level users.

    Any time frame when this functionality will be implemented or do you know of a quick and dirty workaround?

    Thanks

  4. prophecy2040
    Member
    Plugin Author

    Posted 3 years ago #

    b33fheart -
    You could very easily edit the plugin to add super admin only access.
    I am not sure when I will have a new version out, but until then, if you decide you want to edit it, do the following:
    On line 78, change the '10' to 'manage_network_options' like so -

    add_options_page( 'Global Hide/Remove Admin Bar Plugin Options', 'Admin Bar Options','manage_network_options', 'admin-bar-plugin', 'gabrhp_admin_bar_page' );

    That will give it Super Admin access and it will not show up in the user level menus.

    Best of luck.
    Don

  5. b33fheart
    Member
    Posted 3 years ago #

    I notice your site is down and therefore I can't make a donation. Thought you might want to know that.

  6. b33fheart
    Member
    Posted 3 years ago #

    I'll give this a whirl -- thanks a lot !

  7. prophecy2040
    Member
    Plugin Author

    Posted 3 years ago #

    Thanks for the info. We are actually working on a new site - just have not have the time to get it up yet. The donation link was mistakenly left out on the temporary site navigation.

    The new donation link is http://www.fischercreativemedia.com/donations/.

    Donations are not expected, but always appreciated!

    Warm regards,
    Don

  8. b33fheart
    Member
    Posted 3 years ago #

    Sorry Don -- being an uber dunce here but from your instruction I don't see the line to edit. Please could you clarify.

    thank you

  9. prophecy2040
    Member
    Plugin Author

    Posted 3 years ago #

    sorry - that is my fault. I was thinking you were referring to another plugin.

    It SHOULD be line 95 and 96 of the page_post_redirect_plugin.php file:

    where the 2 lines say (line 95 & 96):

    add_action( 'admin_menu', array($this,'ppr_add_menu') );
    	add_action( 'admin_menu', array($this,'ppr_add_metabox') );

    change it to this:

    if(current_user_can('manage_network_options')){
    	add_action( 'admin_menu', array($this,'ppr_add_menu') );
    	add_action( 'admin_menu', array($this,'ppr_add_metabox') );
    }

    You are basically wrapping them in an if statement to check for the Super Admin user lever. That will stop it from displaying both the menu and the redirect post_meta box. If you only want the menu off and not the meta box, just wrap the first line in the if statement and leave the second line out.

    Please let me know if you have problems.
    Don

  10. b33fheart
    Member
    Posted 3 years ago #

    Hi Don,

    It didn't work and took site down. Back up now by renaming quick redirect plugin folder via ftp.

    Here was the error:

    Fatal error: Call to undefined function wp_get_current_user() in /home/sitename/public_html/wp-includes/capabilities.php on line 1039

  11. prophecy2040
    Member
    Plugin Author

    Posted 3 years ago #

    I should have tested that out first.
    The user check has to happen after the pluggable.php file has loaded, so the check needs to be moved to the functions a bit later on in the code.

    This should work, (I test it on one of my installs):
    Forget the other stuff I told you. Instead, in the first line of both the ppr_add_menu function (about line 116) and the ppr_add_metabox function (about line 415), add this line:
    if(!current_user_can('manage_network_options')){return;}
    So, it would look like this:

    function ppr_add_metabox(){
    	if(!current_user_can('manage_network_options')){return;}
    	//rest of function here...

    and

    function ppr_add_menu(){
    	if(!current_user_can('manage_network_options')){return;}
    	//rest of function here...

    Again, let me know if you have problems.
    Don

  12. b33fheart
    Member
    Posted 3 years ago #

    All hunky dory now -- thanks for your time Don ;-)

    Cheers,

    Steve

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Quick Page/Post Redirect Plugin
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic