<?php do_action('bp_before_activity_type_tab_mentions'); ?> <li id="activity-mentions"><a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/'; ?> " title="<?php _e('Activity that I have been mentioned in.', 'buddypress'); ?> "><?php _e('Mentions', 'buddypress'); if (bp_get_total_mention_count_for_user(bp_loggedin_user_id())) { ?> <strong><span><?php printf(_nx('%s new', '%s new', bp_get_total_mention_count_for_user(bp_loggedin_user_id()), 'Number of new activity mentions', 'buddypress'), bp_get_total_mention_count_for_user(bp_loggedin_user_id())); ?> </span></strong><?php } ?> </a></li> <?php } ?> <?php } ?> <?php
<?php do_action('bp_before_activity_type_tab_mentions'); ?> <li id="activity-mentions"><a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/'; ?> " title="<?php _e('Activity that I have been mentioned in.', 'buddypress'); ?> "><?php _e('Mentions', 'buddypress'); if (bp_get_total_mention_count_for_user(bp_loggedin_user_id())) { ?> <strong><?php printf(__('<span>%s new</span>', 'buddypress'), bp_get_total_mention_count_for_user(bp_loggedin_user_id())); ?> </strong><?php } ?> </a></li> <?php } ?> <?php do_action('bp_activity_type_tabs'); ?> </ul> </div><!-- .item-list-tabs -->
/** * Set up the component entries in the WordPress Admin Bar. * * @since BuddyPress (1.5) * * @see BP_Component::setup_nav() for a description of the $wp_admin_nav * parameter array. * @uses is_user_logged_in() * @uses trailingslashit() * @uses bp_get_total_mention_count_for_user() * @uses bp_loggedin_user_id() * @uses bp_is_active() * @uses bp_get_friends_slug() * @uses bp_get_groups_slug() * * @param array $wp_admin_nav See BP_Component::setup_admin_bar() for a * description. */ public function setup_admin_bar($wp_admin_nav = array()) { $bp = buddypress(); // Menus for logged in user if (is_user_logged_in()) { // Setup the logged in user variables $user_domain = bp_loggedin_user_domain(); $activity_link = trailingslashit($user_domain . $this->slug); // Unread message count if (bp_activity_do_mentions()) { $count = bp_get_total_mention_count_for_user(bp_loggedin_user_id()); if (!empty($count)) { $title = sprintf(__('Mentions <span class="count">%s</span>', 'buddypress'), number_format_i18n($count)); } else { $title = __('Mentions', 'buddypress'); } } // Add the "Activity" sub menu $wp_admin_nav[] = array('parent' => $bp->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => __('Activity', 'buddypress'), 'href' => trailingslashit($activity_link)); // Personal $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-personal', 'title' => __('Personal', 'buddypress'), 'href' => trailingslashit($activity_link)); // Mentions if (bp_activity_do_mentions()) { $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-mentions', 'title' => $title, 'href' => trailingslashit($activity_link . 'mentions')); } // Favorites $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-favorites', 'title' => __('Favorites', 'buddypress'), 'href' => trailingslashit($activity_link . 'favorites')); // Friends? if (bp_is_active('friends')) { $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-friends', 'title' => __('Friends', 'buddypress'), 'href' => trailingslashit($activity_link . bp_get_friends_slug())); } // Groups? if (bp_is_active('groups')) { $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-groups', 'title' => __('Groups', 'buddypress'), 'href' => trailingslashit($activity_link . bp_get_groups_slug())); } } parent::setup_admin_bar($wp_admin_nav); }
/** * Set up the component entries in the WordPress Admin Bar. * * @since 1.5.0 * * @see BP_Component::setup_nav() for a description of the $wp_admin_nav * parameter array. * @uses is_user_logged_in() * @uses trailingslashit() * @uses bp_get_total_mention_count_for_user() * @uses bp_loggedin_user_id() * @uses bp_is_active() * @uses bp_get_friends_slug() * @uses bp_get_groups_slug() * * @param array $wp_admin_nav See BP_Component::setup_admin_bar() for a * description. */ public function setup_admin_bar($wp_admin_nav = array()) { // Menus for logged in user. if (is_user_logged_in()) { // Setup the logged in user variables. $activity_link = trailingslashit(bp_loggedin_user_domain() . bp_get_activity_slug()); // Unread message count. if (bp_activity_do_mentions()) { $count = bp_get_total_mention_count_for_user(bp_loggedin_user_id()); if (!empty($count)) { $title = sprintf(_x('Mentions <span class="count">%s</span>', 'Toolbar Mention logged in user', 'buddypress'), bp_core_number_format($count)); } else { $title = _x('Mentions', 'Toolbar Mention logged in user', 'buddypress'); } } // Add the "Activity" sub menu. $wp_admin_nav[] = array('parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->id, 'title' => _x('Activity', 'My Account Activity sub nav', 'buddypress'), 'href' => $activity_link); // Personal. $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-personal', 'title' => _x('Personal', 'My Account Activity sub nav', 'buddypress'), 'href' => $activity_link); // Mentions. if (bp_activity_do_mentions()) { $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-mentions', 'title' => $title, 'href' => trailingslashit($activity_link . 'mentions')); } // Favorite activity items. if (bp_activity_can_favorite()) { $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-favorites', 'title' => _x('Favorites', 'My Account Activity sub nav', 'buddypress'), 'href' => trailingslashit($activity_link . 'favorites')); } // Friends? if (bp_is_active('friends')) { $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-friends', 'title' => _x('Friends', 'My Account Activity sub nav', 'buddypress'), 'href' => trailingslashit($activity_link . bp_get_friends_slug())); } // Groups? if (bp_is_active('groups')) { $wp_admin_nav[] = array('parent' => 'my-account-' . $this->id, 'id' => 'my-account-' . $this->id . '-groups', 'title' => _x('Groups', 'My Account Activity sub nav', 'buddypress'), 'href' => trailingslashit($activity_link . bp_get_groups_slug())); } } parent::setup_admin_bar($wp_admin_nav); }
<?php do_action('bp_before_activity_type_tab_mentions'); ?> <li id="activity-mentions"><a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/'; ?> " title="<?php _e('Activity that I have been mentioned in.', 'logicalboneshug'); ?> "><?php _e('Mentions', 'logicalboneshug'); if (bp_get_total_mention_count_for_user(bp_loggedin_user_id())) { ?> <strong><?php printf(__('<span>%s new</span>', 'logicalboneshug'), bp_get_total_mention_count_for_user(bp_loggedin_user_id())); ?> </strong><?php } ?> </a></li> <?php } ?> <?php do_action('bp_activity_type_tabs'); ?> </ul> </div><!-- .item-list-tabs -->
<?php do_action('bp_before_activity_type_tab_mentions'); ?> <li id="activity-mentions"><a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/'; ?> " title="<?php _e('Activity that I have been mentioned in.', 'firmasite'); ?> "><?php _e('Mentions', 'firmasite'); if (bp_get_total_mention_count_for_user(bp_loggedin_user_id())) { ?> <strong><span><?php printf(_nx('%s new', '%s new', bp_get_total_mention_count_for_user(bp_loggedin_user_id()), 'Number of new activity mentions', 'firmasite'), number_format_i18n(bp_get_total_mention_count_for_user(bp_loggedin_user_id()))); ?> </span></strong><?php } ?> </a></li> <?php } ?> <?php do_action('bp_activity_type_tabs'); ?> </ul> </div><!-- .item-list-tabs -->
/** * Output the total mention count for a specified user. * * @since BuddyPress (1.2.0) * * @see bp_get_total_mention_count_for_user() for description of parameters. * @uses bp_get_total_favorite_count_for_user() * * @param int $user_id See {@link bp_get_total_mention_count_for_user()}. */ function bp_total_mention_count_for_user($user_id = 0) { echo bp_get_total_mention_count_for_user($user_id); }
</span></a></li> <?php } ?> <li id="activity-mentions"> <a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/'; ?> " title="Activity where I'm mentioned">My Mentions <?php if (bp_get_total_mention_count_for_user()) { ?> <span><?php echo bp_get_total_mention_count_for_user(); ?> </span> <?php } ?> </a> </li> <?php } ?> </ul> </nav><!-- #directory-nav --> <?php if (is_user_logged_in()) {
<?php do_action('bp_before_activity_type_tab_mentions'); ?> <li id="activity-mentions"><a href="<?php echo bp_loggedin_user_domain() . bp_get_activity_slug() . '/mentions/'; ?> " title="<?php _e('Activity that I have been mentioned in.', 'wplms_modern'); ?> "><?php _e('Mentions', 'wplms_modern'); if (bp_get_total_mention_count_for_user(bp_loggedin_user_id())) { ?> <strong><span><?php printf(_nx('%s new', '%s new', bp_get_total_mention_count_for_user(bp_loggedin_user_id()), 'Number of new activity mentions', 'wplms_modern'), bp_get_total_mention_count_for_user(bp_loggedin_user_id())); ?> </span></strong><?php } ?> </a></li> <?php } ?> <?php } ?> <?php
<?php if ( function_exists( 'bp_get_total_group_count_for_user' ) ) : ?> <?php if ( bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) : ?> <li id="activity-groups"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/' . BP_GROUPS_SLUG . '/' ?>" title="<?php _e( 'The activity of groups I am a member of.', 'buddypress' ) ?>"><?php printf( __( 'My Groups (%s)', 'buddypress' ), bp_get_total_group_count_for_user( bp_loggedin_user_id() ) ) ?></a></li> <?php endif; ?> <?php endif; ?> <?php do_action( 'bp_before_activity_type_tab_favorites' ) ?> <?php if ( bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ) : ?> <li id="activity-favorites"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/favorites/' ?>" title="<?php _e( "The activity I've marked as a favorite.", 'buddypress' ) ?>"><?php printf( __( 'My Favorites (<span>%s</span>)', 'buddypress' ), bp_get_total_favorite_count_for_user( bp_loggedin_user_id() ) ) ?></a></li> <?php endif; ?> <?php do_action( 'bp_before_activity_type_tab_mentions' ) ?> <li id="activity-mentions"><a href="<?php echo bp_loggedin_user_domain() . BP_ACTIVITY_SLUG . '/mentions/' ?>" title="<?php _e( 'Activity that I have been mentioned in.', 'buddypress' ) ?>"><?php printf( __( '@%s Mentions', 'buddypress' ), bp_get_loggedin_user_username() ) ?><?php if ( bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) : ?> <strong><?php printf( __( '(%s new)', 'buddypress' ), bp_get_total_mention_count_for_user( bp_loggedin_user_id() ) ) ?></strong><?php endif; ?></a></li> <?php endif; ?> <?php do_action( 'bp_activity_type_tabs' ) ?> </ul> </div><!-- .item-list-tabs --> <div class="item-list-tabs no-ajax" id="subnav"> <ul> <li class="feed"><a href="<?php bp_sitewide_activity_feed_link() ?>" title="<?php _e( 'RSS Feed', 'buddypress' ); ?>"><?php _e( 'RSS', 'buddypress' ) ?></a></li> <?php do_action( 'bp_activity_syndication_options' ) ?> <li id="activity-filter-select" class="last"> <select>
/** * @group bp_activity_remove_screen_notifications * @group mentions * @ticket BP6687 */ public function test_bp_activity_remove_screen_notifications_on_new_mentions_cleared() { $this->create_notifications(); $notifications = BP_Notifications_Notification::get(array('item_id' => $this->a1)); // Double check it's there $this->assertEquals(array($this->a1), wp_list_pluck($notifications, 'item_id')); $this->assertEquals(1, bp_get_total_mention_count_for_user($this->u1)); // Clear notifications for $this->u1 bp_activity_clear_new_mentions($this->u1); $notifications = BP_Notifications_Notification::get(array('item_id' => $this->a1)); $this->assertEmpty($notifications, 'Notifications should be cleared when new mention metas are removed'); $this->assertEmpty(bp_get_total_mention_count_for_user($this->u1)); }