UM_Admin_Roles

The Ultimate Member UM Admin Roles class.

Defined (1)

The class is defined in the following location(s).

/admin/core/um-admin-roles.php  
  1. class UM_Admin_Roles { 
  2.  
  3. function __construct() { 
  4.  
  5. add_filter('manage_edit-um_role_columns', array(&$this, 'manage_edit_um_role_columns') ); 
  6. add_action('manage_um_role_posts_custom_column', array(&$this, 'manage_um_role_posts_custom_column'), 10, 3); 
  7. add_filter( 'post_row_actions', array(&$this, 'remove_row_actions' ), 10, 2 ); 
  8.  
  9.  
  10. function remove_row_actions( $actions, $post ) { 
  11. global $ultimatemember; 
  12. if( $post->post_type != 'um_role' ) return $actions; 
  13.  
  14. if( $ultimatemember->query->is_core( $post->ID ) ) { 
  15. unset( $actions['trash'] ); 
  16. unset( $actions['inline hide-if-no-js'] ); 
  17.  
  18. return $actions; 
  19. /*** 
  20. *** @Custom columns for Role 
  21. ***/ 
  22. function manage_edit_um_role_columns($columns) { 
  23.  
  24. $admin = new UM_Admin_Metabox(); 
  25.  
  26. $new_columns['cb'] = '<input type="checkbox" />'; 
  27. $new_columns['title'] = __('Role Title', 'ultimatemember'); 
  28. $new_columns['count'] = __('No. of Members', 'ultimatemember') . $admin->_tooltip( __('The total number of members who have this role on your site', 'ultimatemember') ); 
  29. $new_columns['core'] = __('Core / Built-in', 'ultimatemember') . $admin->_tooltip( __('A core role is installed by default and may not be removed', 'ultimatemember') ); 
  30. $new_columns['has_wpadmin_perm'] = __('WP-Admin Access', 'ultimatemember') . $admin->_tooltip( __('Let you know If users of this role can view the WordPress backend or not', 'ultimatemember') ); 
  31.  
  32. return $new_columns; 
  33.  
  34.  
  35. /*** 
  36. *** @Display custom columns for Role 
  37. ***/ 
  38. function manage_um_role_posts_custom_column($column_name, $id) { 
  39. global $wpdb, $ultimatemember; 
  40.  
  41. switch ($column_name) { 
  42.  
  43. case 'has_wpadmin_perm': 
  44. if ( $ultimatemember->query->is_core( $id ) ) { 
  45. $role = $ultimatemember->query->is_core( $id ); 
  46. } else { 
  47. $post = get_post($id); 
  48. $role = $post->post_name; 
  49. $data = $ultimatemember->query->role_data($role); 
  50. if ( isset( $data['can_access_wpadmin'] ) && $data['can_access_wpadmin'] == 1 ) { 
  51. echo '<span class="um-adm-ico um-admin-tipsy-n" title="'.__('This role can access the WordPress backend', 'ultimatemember').'"><i class="um-faicon-check"></i></span>'; 
  52. } else { 
  53. echo __('No', 'ultimatemember'); 
  54. break; 
  55.  
  56. case 'count': 
  57. if ( $ultimatemember->query->is_core( $id ) ) { 
  58. $role = $ultimatemember->query->is_core( $id ); 
  59. } else { 
  60. $post = get_post($id); 
  61. $role = $post->post_name; 
  62. echo $ultimatemember->query->count_users_by_role( $role ); 
  63. break; 
  64.  
  65. case 'core': 
  66. if ( $ultimatemember->query->is_core( $id ) ) { 
  67. echo '<span class="um-adm-ico um-admin-tipsy-n" title="'.__('Core', 'ultimatemember').'"><i class="um-faicon-check"></i></span>'; 
  68. } else { 
  69. echo '—'; 
  70. break; 
  71.  
  72.  
  73.