Title: WP Admin bar &#8211; Adding notification counter bubble
Last modified: September 11, 2020

---

# WP Admin bar – Adding notification counter bubble

 *  [consuleregroup](https://wordpress.org/support/users/consuleregroup/)
 * (@consuleregroup)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/wp-admin-bar-adding-notification-counter-bubble/)
 * Hi all,
 * I am interested to add a notification counter bubble at the “Users” section on
   the WP admin bar whenever a new user is registered. How would I go about this?
 * Kind regards,
    CG

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [unfinishedcode](https://wordpress.org/support/users/unfinishedcode/)
 * (@unfinishedcode)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/wp-admin-bar-adding-notification-counter-bubble/#post-13393589)
 * I would count the number of users that registered than an hour ago. Then display
   it to the admin bar.
 * Count users –
 *     ```
       <?php 
       	$arrUsers = get_users();
       	$strDate = date("Y-m-d H:i:s", strtotime('-1 hour'));
       	$intNewUsers = 0;
       	if(is_array($arrUsers)) {
       		foreach ($arrUsers as $key => $value) {
       			if($key == "user_registered" && $value > $strDate) {
       				$intNewUsers++;
       			}
       		}
       	}
       	echo $intNewUsers." New Users Since ".$strDate;
       ?>
       ```
   
 * My code might not be accurate, but its a good start:)
    Alter the admin bar – 
   [https://www.isitwp.com/add-links-to-wordpress-3-3-new-toolbar/](https://www.isitwp.com/add-links-to-wordpress-3-3-new-toolbar/)
    -  This reply was modified 5 years, 8 months ago by [bcworkz](https://wordpress.org/support/users/bcworkz/).
      Reason: code fixed
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/wp-admin-bar-adding-notification-counter-bubble/#post-13398053)
 * Hey [@unfinishedcode](https://wordpress.org/support/users/unfinishedcode/), when
   you post code in these forums, please demarcate with backticks or use the code
   button. Otherwise the forum’s parser corrupts your code, making it difficult 
   for others to use it. I fixed the code in your last reply to this topic so consuleregroup
   can use it without encountering syntax errors.
 *  [unfinishedcode](https://wordpress.org/support/users/unfinishedcode/)
 * (@unfinishedcode)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/wp-admin-bar-adding-notification-counter-bubble/#post-13398056)
 * Awesome, thanks dude. Will do so in the future.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘WP Admin bar – Adding notification counter bubble’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 3 participants
 * Last reply from: [unfinishedcode](https://wordpress.org/support/users/unfinishedcode/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/wp-admin-bar-adding-notification-counter-bubble/#post-13398056)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
