show users phone number in users screen
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
class Wiaas_Admin_Contacts {
|
||||
|
||||
public static function init() {
|
||||
add_filter( 'manage_users_columns', array(__CLASS__, 'modify_users_screen_table_columns'), 999, 1 );
|
||||
|
||||
add_filter( 'manage_users_custom_column', array(__CLASS__, 'fill_custom_columns'), 10, 3);
|
||||
}
|
||||
|
||||
public static function modify_users_screen_table_columns( $columns ) {
|
||||
|
||||
$show_columns = array();
|
||||
|
||||
$show_columns['cb'] = $columns['cb'];
|
||||
$show_columns['username'] = $columns['username'];
|
||||
$show_columns['name'] = $columns['name'];
|
||||
$show_columns['email'] = $columns['email'];
|
||||
$show_columns['phone'] = __( 'Phone', 'wiaas' );
|
||||
$show_columns['role'] = $columns['role'];
|
||||
$show_columns['wiaas-user-organization'] = $columns['wiaas-user-organization'];
|
||||
|
||||
return $show_columns;
|
||||
|
||||
}
|
||||
|
||||
public static function fill_custom_columns ($empty, $column, $user_id){
|
||||
if ($column == 'phone'){
|
||||
return get_the_author_meta('phone', $user_id) ?: '-';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Wiaas_Admin_Contacts::init();
|
||||
@@ -36,6 +36,8 @@ class Wiaas_Admin {
|
||||
|
||||
require_once dirname(__FILE__) . '/admin/class-wiaas-admin-dashboard.php';
|
||||
|
||||
require_once dirname( __FILE__) . '/admin/class-wiaas-admin-contacts.php';
|
||||
|
||||
add_action( 'admin_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'), 100 );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user