Hi Jason,
Send here the link to that plugin. I will look on it.
Regards,
Vladimir.
Hi Vladimir,
The plugin I’m referring to is;
http://wordpress.org/extend/plugins/redirection/
Many thanks,
Jas
Hi Jason,
Redirection plugin uses ‘Administrator’ role to define access level to its menu. You can see it at line #120 of file redirection.php
function admin_menu() {
add_management_page( __( "Redirection", 'redirection' ), __( "Redirection", 'redirection' ), "administrator", basename( __FILE__ ), array( &$this, "admin_screen" ) );
}
Change ‘administrator’ there to the ‘editor’ and all your editors will have access to this plugin. Just be aware, that you lose this modification with every plugin update. Other way to achieve this is a plugin like the ‘Admin Menu Editor’, which is capable to modify admin menu permission on the fly according to your settings.
Regards,
Vladimir.
Hi Vladimir,
The ‘Admin Menu Editor’ looks like a great option – thanks heaps for your help!
Jas
How can this be done without editing the plugin file? I would like to make sure that the plugin can be updated by a non-technical user who doesn’t know how to edit plugin files.
Look on a plugin like the ‘Admin Menu Editor’, which is capable to modify admin menu permission on the fly according to your settings. Create your own custom capability with User Role Editor, assign it to the role or selected user. Then change selected menu item capability to your custom created one using Admin Menu Editor.
Thanks!
I am using User Role Editor.
I see how to make a new Capability, but I do not see how to edit the functionality of that capability.
I am looking at your post: http://shinephp.com/user-role-editor-wordpress-plugin/#faq
Thanks again for your help.
-Josh
It’s the subject of some coding.
Search for ‘current_user_can’ at the post you mentioned above.
Thanks!
I added this, but it is not working:
//Giving Editors Access to Redirection plugin
function admin_menu() {
add_management_page( __( "Redirection", 'redirection' ), __( "Redirection", 'redirection' ), "editor", basename( __FILE__ ), array( &$this, "admin_screen" ) );
}
//Add Redirection capability through User Role Editor plugin
if (!current_user_can('Redirection')) {
echo "You don't have permission for it!";
return;
}
Sorry, It can not work at all.
function admin_menu()
is a method of class at the plugin, which permission you wish to modify.
You can not just take out method from the class, put it somewhere else and wait that it will work.
‘this’ at array( &$this, "admin_screen" )
is the reference to the plugin PHP object. Your theme functions.php know nothing about it.
Code fragment from my post is useful if you place it to your own plugin or prevent user from use some functionality. In this case it is useless.
Please think, if it could be possible to achieve your goal just placing 3-5 lines of code to the functions.php, why I didn’t share this information with you?
Because of I with my knowledge of PHP and WordPress API do not know how to do it without modifying plugin code directly or use other plugin, created especially for that.
Thanks for your interest and using User Role Editor.
Thanks. That makes sense. 😉
So there is not an easy way to achieve this goal?
Yes, without plugin code modification – No. Excuse me for the wordplay ;).
That’s okay. Your English is much better than my Russian! Thanks for your help.