deltakid
Member
Posted 16 years ago #
I would like to hide the "Plugins" section from users. I already use the Plugin Manager and Plugin Commander and would like to be able to prevent users switchting plugins on and off.
I guess the easiest method of doing this is just by hiding the menu point in the admin area (and maybe including a permissions check in the plugin.php file that only admins can access the page).
Has anyone an idea how to do this?
deltakid
Member
Posted 16 years ago #
Ok.. ok I found a way to do this. Comment the lines 410 and 411 of your wp-admin/includes/mu.php out
/* if( $menu_perms[ 'plugins' ] == 1 )
$menu[35] = array(__('Plugins'), 'activate_plugins', 'plugins.php');*/
Any other suggestions how to do this more elegant are appreciated.
cafespain
Member
Posted 16 years ago #
Or go to the Site admin menu, click on Options.
Scroll down to the bottom and uncheck the Enabled box next to the Plugins option.
but I thought with plugin commander yo ucoudl auto activate a plugin, and do not give user control over it, combined with disabling the "normal" plugins menu that is the solution?
deltakid
Member
Posted 16 years ago #
No cafespain if I do this I can't use plugins or enable them individually for single blogs.
@Ovidiu
That's right. That's how I do it.
cafespain
Member
Posted 16 years ago #
@deltakid: Yes you can. You switch on the plugins menu - activate the plugin for the users blog and switch off the plugins menu. Takes less than 30 seconds. But then I only have a few sites so it isn't much hassle for me.
deltakid,
I use an mu-plugin to reshape the menu for all blogs/users.
http://mu.wordpress.org/forums/topic.php?id=8482
deltakid
Member
Posted 16 years ago #
yes cafespain that works as well. that was how i did it initially. but now i get emails when a user has filled out a certain form and just click a link to activate the appropriate plugin for his blog. that's easier for me.
and thanks dsader that's perfect! works great and a very elegant solution much appreciated!
@dsader
Your solution works excellent. Thanks a lot. But what about hiding Advanced Options (Excerpt, Trackbacks,...)?
Boonika, look closely at the edit-form-advanced.php for the divs with id, and add style to the header to hide the div. Add something like this to an mu-plugin:
<?php function ds_hide_post_form () {
?>
<style>
#postcustom {
display: none;
}
#pagepostcustom {
display: none;
}
#postexcerpt {
display: none;
}
#trackbacksdiv {
display: none;
}
</style>
<?php }
add_action( 'admin_head', 'ds_hide_post_form' );
?>
That's what I did. Searched inside edit-form-advanced.php and found those lines of code but didn't know how to write a plugin to disable those functions. Thanks a lot for this simple solution.
@dsader
Now this is strange. I swear that your 'redirect' plugin yesterday worked just fine. Now, when I enter direct URL, for example; http://blog1.example.com/wp-admin/post-new.php redirect doesn't work which means that I'm able to visit actual URL.
Also, the solution you provided in your last post works GRAET but only for Write/Post and not for Write/Page Advanced Options. They are still displayed.
I forgot to say something that might be important. I'm using those plugins as Plugins, not MU-Plugins. I've added header so I can activate them inside the administration.
Anyway, once again, thanks for your help.
@dsader - 'redirect' problem solved
Sorry, looks like it was my lack of knowledge. I just pasted your code which has only themes.php included. That's why redirect didn't work for other pages.
@dsader - 'hide Wrie/Page options' problem solved
Thanks
Boonika,
Look at the edit-page-form.php to modify display of the page editor.
The divs ids change names depending on the version.
@dsader
Yes that's what I already did. Right now I'm struggling with hiding Dashboard. Actually, I'm trying to apply above mentioned 'redirect' function. All other menus (ones that I don't need) are hidden and when user enters hidden menu URL he gets redirected to page-new.php.
add to a mu-plugin
function ds_hide_dash() {
wp_redirect('post-new.php');
exit();
}
add_action( 'wp_dashboard_setup','ds_hide_dash' );
Thanks dsader. You've helped me a lot. I think that you should collect all those codes and create a plugin called 'Dsader Admin Options' or something like that... just a thought. Thanks.
When I think about it now, I couldn't agree with you more. More people should KISS:)
musnake
Member
Posted 16 years ago #
Yes, a _dilute_koolaid.php is in order, with a bit of this for the crafty...