WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am wondering if it's possible to split out notifications in the top bar (the ones that pop up in wp-top bar) to their own individual menu items: 'notifications' 'messages' and 'friend requests', rather than them all being under the notification drop down. Basically I'd like to achieve the effect that Facebook makes with their notifications. If any one could steer me in the right direction I would be most greatful

p.s. I am a front end developer, not the most PHP savvy guy in the world.


share|improve this question

closed as off-topic by ialocin, kaiser Aug 7 '14 at 11:18

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

Assuming that you are talking about the WP Toolbar, not the BuddyBar. (The basics of doing this for the BuddyBar are the same at the BP level, but the details of rendering the content are different.)

It will be instructive to look at how BP itself builds its Notifications dropdown, in bp_members_admin_bar_notifications_menu() (bp-members/bp-members-adminbar.php). It uses the BP function bp_core_get_notifications_for_user() to call up a list of notifications. Here's the thing about the latter function: Internally, it organizes notifications by type (in order to get counts) before flattening them out again. That means that your strategy would be to build your own version of bp_core_get_notifications_for_user(), borrowing the grouping logic, but then not collapsing all notifications into a single object, but instead returning an object that contains just a certain type of notification (based either on what is called there $notification->component_name or $notification->component_action). Then create new WP Toolbar menus based on the info returned, using exactly the same logic used in bp_members_admin_bar_notifications_menu() but multiplied by three (for Notifications, Messages, and Friend Requests).

I think it would be a reasonable enhancement request for BuddyPress itself that there be a component or action parameter (or both) for bp_core_get_notifications_for_user(). You can leave this request at http://buddypress.trac.wordpress.org if you would like.

share|improve this answer

You could modify the admin bar by hooking into the functions that render it. That would require coding a custom plugin.

Modifying the BuddyPress admin bar

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.