Skip to content

Instantly share code, notes, and snippets.

@bentasm1
Created January 18, 2016 19:38
Show Gist options
  • Save bentasm1/293eb4673179a5f34c7c to your computer and use it in GitHub Desktop.
Save bentasm1/293eb4673179a5f34c7c to your computer and use it in GitHub Desktop.
BuddyPress Show if User has New Private Messages
/* This code goes into one of the WC Vendors Templates. Which one? Depends where you want to show it on the dashboard. :) */
/* Shows unread messages button */
$unread = bp_get_total_unread_messages_count();
$current_user = wp_get_current_user();
if ( $unread > 0 ) {
echo '<a href="/members/' . $current_user->user_login . '/messages/">You have ' . $unread . ' Unread Private Messages</a>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment