Thanks for very handy plugin! I’m looking for a way to hide the dashboard widget from everyone but the site admin. I have tried the following code, without success:
add_action('wp_dashboard_setup', 'jr_mss_hide_widget_on_dashboard');
function jr_mss_hide_widget_on_dashboard() {
global $pagenow;
if (!is_admin() || $pagenow !== 'index.php') {
return;
}
if (!current_user_can('administrator')) {
remove_meta_box('simple_space_widget', 'dashboard', 'side');
}
}
I have also tried the above code with the ‘admin_init’ hook, with the same (unsuccessful) result. Is it at all possible to hide the widget from specific user roles?
Thanks.
Edit: …aaand, it turns out, all I had to do was to add a priority argument, like this:
add_action('wp_dashboard_setup', 'jr_mss_hide_widget_on_dashboard', 999);
function jr_mss_hide_widget_on_dashboard() {
global $pagenow;
if (!is_admin() || $pagenow !== 'index.php') {
return;
}
if (!current_user_can('administrator')) {
remove_meta_box('simple_space_widget', 'dashboard', 'side');
}
}
I really should explore things more carefully before I ask questions in the forum, hehe. Thanks again for a neat plugin!
/jenny
]]>I’ve come across a situation where I need to work on a life website, more specificly on content that is only available to logged in users. So while I’m restructuring that particular area, I would a login notification to display when non admin users are trying to log in. Something along the lines of:
Login Area currently unavailable. Please try again later.
If you ever have a free minute, maybe think about a setting that can allow to do that.
Cheers and keep it up man, TML rocks!
https://www.ads-software.com/plugins/theme-my-login/
]]>Thanks for niche plugin which does exactly what it promises.
If this plugin is still supported, could you kindly comment how we can allow non admins to upload media please.
Detail: using WPUserFrontend plugin, I allow front end post management. When an Admin is logged in ‘Upload Media’ works well. But non-admins are blocked by ‘RDA’ to upload media. If ‘RDA’ is uninstalled then non-admins are again capable to upload media.
I am sure (hopeful) – a fix exists that allow me to keep this plugin and allow non-admin’s access to upload media.
Any help would be appericiated, I am going live with this in two days pls.
https://www.ads-software.com/plugins/remove-dashboard-access-for-non-admins/
]]>https://www.ads-software.com/extend/plugins/role-scoper/
]]>add_action('admin_init', 'no_mo_dashboard');
function no_mo_dashboard() {
if (!current_user_can('manage_options') && $_SERVER['DOING_AJAX'] != '/wp-admin/admin-ajax.php') {
wp_redirect(home_url()); exit;
}
}
and this as well..
function baw_no_admin_access()
{
if( !current_user_can( 'administrator' ) )
wp_redirect( home_url() );
die();}
add_action( 'admin_init', 'baw_no_admin_access', 1 );
[Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
Both codes are doing what they are supposed to. But one unusual behavior I noticed that the non admins are not able to post anything. Neither any posts nor any comments of non admins are posted. What’s wrong ?
]]>/**
* Adds an SEO admin bar menu with several options. If the current user is an admin he can also go straight to several settings menu's from here.
*/
function wpseo_admin_bar_menu() {
// If the current user can't write posts, this is all of no use, so let's not output an admin menu
if ( !current_user_can( '<strong>edit_posts</strong>' ) )
return;
If I replaced the bolded capability with, say, delete_users, will that make the SEO menu show up in the admin bar ONLY for admins????
https://www.ads-software.com/extend/plugins/wordpress-seo/
]]>