/** * Set up the navigation. * * @since 1.0.0 * @access public * * @param array $main_nav Optional. See BP_Component::setup_nav(). * @param array $sub_nav Optional. See BP_Component::setup_nav(). */ function setup_nav($main_nav = array(), $sub_nav = array()) { $count = Mute::get_count(bp_displayed_user_id()); $class = $count === 0 ? 'no-count' : 'count'; $main_nav = array('name' => sprintf(__('Mute <span class="%s">%s</span>', 'buddypress-mute'), esc_attr($class), number_format_i18n($count)), 'position' => 80, 'default_subnav_slug' => 'all', 'slug' => $this->slug, 'item_css_id' => $this->id, 'show_for_displayed_user' => bp_core_can_edit_settings(), 'screen_function' => 'bp_mute_all_screen'); $sub_nav[] = array('name' => __('All', 'buddypress-mute'), 'slug' => 'all', 'position' => 10, 'parent_slug' => $this->slug, 'parent_url' => trailingslashit(bp_displayed_user_domain() . $this->slug), 'user_has_access' => bp_core_can_edit_settings(), 'screen_function' => 'bp_mute_all_screen'); if (bp_is_active('friends')) { $sub_nav[] = array('name' => __('Friends', 'buddypress-mute'), 'slug' => 'friends', 'position' => 20, 'parent_slug' => $this->slug, 'parent_url' => trailingslashit(bp_displayed_user_domain() . $this->slug), 'user_has_access' => bp_core_can_edit_settings(), 'screen_function' => 'bp_mute_friends_screen'); } parent::setup_nav($main_nav, $sub_nav); }
/** * Filter the members loop to show all muted users. * * @since 1.0.0 * * @param array $r Arguments for changing the contents of the loop. * @return array */ function bp_mute_filter_members_all($r) { if (bp_is_current_component('mute') && bp_is_current_action('all')) { $ids = Mute::get_muting(bp_displayed_user_id()); if (empty($ids)) { $r['include'] = 0; } else { $r['include'] = $ids; } } return $r; }