custom dashboard per user role
-
Hi everyone,
I’m trying toto customize the dashboard of my blog according to my users roles.
specifically I want to delete some widgets, place some new, delete some menu entries, change the css.now, I’m not good at coding and I need your help.
I read that to adress a user role, in my case an author, I can you this code:
global $current_user; get_currentuserinfo(); if ($current_user->user_level < 3)
nice.
I need however to know how to use this with other functions, like the one to remove widgets:function remove_dashboard_widgets(){ global$wp_meta_boxes; unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']); unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']); } add_action('wp_dashboard_setup', 'remove_dashboard_widgets');
(and yes, nazi moderator, it’s 9 lines of code, not 11 like the one you deleted for exceeding of 1 the 10 lines rule.)
if you can also explain the theory of how you built the code I can do it myself for the next customization.
however any help is very welcome because I’m stuck.
thank you guys!
Michel
- The topic ‘custom dashboard per user role’ is closed to new replies.