show/hide columns based on user role
-
I want to be able to add a column to tables which is ONLY viewable to certain user roles. The information isn’t super sensitive so I’m thinking the simplest way is just by manipulating the column width to zero or whatever, when a certain user role is detected.
The functino for detecting the user role is straighforward and found on the web:
function wcmo_get_current_user_roles() {
if( is_user_logged_in() ) {
$user = wp_get_current_user();
$roles = ( array ) $user->roles;
return $roles[0];
} else {
return array();
}
}
but I’m unsure which php file contains the code which displays the table.Can you let me know which file to edit please?
thanks
Guy
- The topic ‘show/hide columns based on user role’ is closed to new replies.