Get Number of Pending Users
-
I’m trying to add a “Pending Users Count” onto the “Users” main menu via a bubble. The code looks like this (feel free to implement 😀 !). Now
$numPending
is supposed to hold the number of pending users so my question is: Do you have a function to get the number of pending users?/** Add Post Pending Bubble to CPT **/ function pending_posts_bubble(){ global $menu; // Count Number of Pending Members $numPending = 4; // Make sure there are pending members if ( $numPending > 0 ) { // Locate the key of $key = recursive_array_search_php_91365( "users.php", $menu ); // Not found, just in case if( !$key ) return; // Modify menu item $menu[$key][0] .= sprintf( '<span class="update-plugins count-%1$s" style="background-color:white;color:black;margin-left:5px;"><span class="plugin-count">%1$s</span></span>', $numPending ); } } add_action( 'admin_menu', 'pending_posts_bubble', 999 ); // http://www.php.net/manual/en/function.array-search.php#91365 function recursive_array_search_php_91365( $needle, $haystack ) { foreach( $haystack as $key => $value ) { $current_key = $key; if( $needle === $value OR ( is_array( $value ) && recursive_array_search_php_91365( $needle, $value ) !== false ) ) { return $current_key; } } return false; }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Get Number of Pending Users’ is closed to new replies.