diff --git a/class-vip-support-user.php b/class-vip-support-user.php
index 5347f47..03116dd 100644
--- a/class-vip-support-user.php
+++ b/class-vip-support-user.php
@@ -149,6 +149,7 @@ public function __construct() {
add_action( 'load-profile.php', array( $this, 'action_load_profile' ) );
add_action( 'profile_update', array( $this, 'action_profile_update' ) );
add_action( 'admin_head', array( $this, 'action_admin_head' ) );
+ add_action( 'admin_footer', array( $this, 'action_admin_footer' ) );
add_action( 'wp_login', array( $this, 'action_wp_login' ), 10, 2 );
// May be added by Cron Control, if used together.
@@ -163,6 +164,7 @@ public function __construct() {
add_filter( 'wp_redirect', array( $this, 'filter_wp_redirect' ) );
add_filter( 'removable_query_args', array( $this, 'filter_removable_query_args' ) );
+ add_filter( 'get_role_list', array( $this, 'filter_users_role_list' ), 10, 2 );
$this->reverting_role = false;
$this->message_replace = false;
@@ -197,6 +199,52 @@ public function action_admin_head() {
}
}
+ /**
+ * If a User has a VIP Support role, create a VIP Support badge to clearly brand as such.
+ *
+ * Because of `filter_users_role_list()`, all VIP Support users will receive the role
+ * "VIP Support" in their role list.
+ *
+ * Since we've modified the roles list for VIP Users, instead of displaying it, staff
+ * can view their role with `wp users list` instead.
+ *
+ * @param array $role_list roles for the user
+ * @param object $user_object the WP_User object
+ *
+ * @return array $role_list
+ */
+ public function action_admin_footer() {
+ if ( 'users' !== get_current_screen()->base ) {
+ return;
+ }
+ ?>
+
+
+ base ) {
+ if ( $user_object->get( self::VIP_SUPPORT_USER_META_KEY ) && ! isset( $role_list['vip_support'] ) ) {
+ $role_list['vip_support'] = 'VIP Support'; // No translation as jQuery replaces this.
+ }
+ }
+ return $role_list;
+ }
+
/**
* Hooks the wp_login action to make any verified VIP Support user
* a Super Admin!