buddyverified_user_columns

Buddyverified_user_columns class.

Defined (1)

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

/includes/class-admin.php  
  1. class buddyverified_user_columns { 
  2.  
  3. /** 
  4. * [$defaults description] 
  5. * @var array 
  6. */ 
  7. var $defaults = array( 
  8. 'nicename',  
  9. 'email',  
  10. 'url',  
  11. 'registered',  
  12. 'user_nicename',  
  13. 'user_email',  
  14. 'user_url',  
  15. 'user_registered',  
  16. 'display_name',  
  17. 'name',  
  18. 'post_count',  
  19. 'ID',  
  20. 'id',  
  21. 'user_login',  
  22. ); 
  23.  
  24. /** 
  25. * __construct function. 
  26. * @access public 
  27. * @param mixed $args 
  28. * @return void 
  29. */ 
  30. function __construct( $args ) { 
  31. $this->args = $args; 
  32. add_action( 'pre_user_query', array( &$this, 'query' ) ); 
  33. add_action( 'manage_users_custom_column', array( &$this, 'content' ), 10, 3 ); 
  34. add_filter( 'manage_users_columns', array( &$this, 'columns' ) ); 
  35. add_filter( 'manage_users_sortable_columns', array( &$this, 'sortable' ) ); 
  36.  
  37. /** 
  38. * Query function. 
  39. * @access public 
  40. * @param mixed $query 
  41. * @return void 
  42. */ 
  43. function query( $query ) { 
  44. $vars = $query->query_vars; 
  45.  
  46. if ( in_array( $vars['orderby'], $this->defaults, true ) ) { 
  47. return; 
  48.  
  49. if ( ! empty( $this->args[ $vars['orderby'] ] ) ) { 
  50. $title = $this->args[ $vars['orderby'] ]; 
  51.  
  52. if ( ! empty( $title ) ) { 
  53. $query->query_from .= " LEFT JOIN wp_usermeta m ON ( wp_users.ID = m.user_id AND m.meta_key = '$vars[orderby]' )"; 
  54.  
  55. $query->query_orderby = 'ORDER BY m.meta_value ' . $vars['order']; 
  56.  
  57.  
  58. /** 
  59. * Columns function. 
  60. * @access public 
  61. * @param mixed $columns 
  62. * @return array 
  63. */ 
  64. function columns( $columns ) { 
  65. foreach ( $this->args as $key => $value ) { 
  66. $columns[ $key ] = $value; 
  67. return $columns; 
  68.  
  69. /** 
  70. * Sortable function. 
  71. * @access public 
  72. * @param mixed $columns 
  73. * @return array 
  74. */ 
  75. function sortable( $columns ) { 
  76. foreach ( $this->args as $key => $value ) { 
  77. $columns[ $key ] = $key; 
  78. return $columns; 
  79.  
  80. /** 
  81. * Content function. 
  82. * @access public 
  83. * @param mixed $value 
  84. * @param mixed $column_name 
  85. * @param mixed $user_id 
  86. * @return string 
  87. */ 
  88. function content( $value, $column_name, $user_id ) { 
  89. $user = get_userdata( $user_id ); 
  90. $meta = get_user_meta( $user_id, 'bp-verified', true ) ? get_user_meta( $user_id, 'bp-verified', true ) : null ; 
  91.  
  92. $value = $user->$column_name; 
  93.  
  94. $values = ''; 
  95.  
  96. if ( $value ) { 
  97. if ( $value ) { 
  98. $values = '<div style="width: 20px; height: 20px; margin: 0 auto;"><img src="' . VERIFIED_URL . '/images/' . $meta['image'] . '.png"></div>' ; 
  99. return $values;