/**
  * Set up component navigation.
  *
  * @since 1.9.0
  *
  * @see BP_Component::setup_nav() for a description of arguments.
  *
  * @param array $main_nav Optional. See BP_Component::setup_nav() for
  *                        description.
  * @param array $sub_nav  Optional. See BP_Component::setup_nav() for
  *                        description.
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     $access = bp_core_can_edit_settings();
     $slug = bp_get_notifications_slug();
     $notifications_link = trailingslashit($user_domain . $slug);
     // Only grab count if we're on a user page and current user has access
     if (bp_is_user() && bp_user_has_access()) {
         $count = bp_notifications_get_unread_notification_count(bp_displayed_user_id());
         $class = 0 === $count ? 'no-count' : 'count';
         $nav_name = sprintf(_x('Notifications <span class="%s">%s</span>', 'Profile screen nav', 'buddypress'), esc_attr($class), bp_core_number_format($count));
     } else {
         $nav_name = _x('Notifications', 'Profile screen nav', 'buddypress');
     }
     // Add 'Notifications' to the main navigation
     $main_nav = array('name' => $nav_name, 'slug' => $slug, 'position' => 30, 'show_for_displayed_user' => $access, 'screen_function' => 'bp_notifications_screen_unread', 'default_subnav_slug' => 'unread', 'item_css_id' => $this->id);
     // Add the subnav items to the notifications nav item
     $sub_nav[] = array('name' => _x('Unread', 'Notification screen nav', 'buddypress'), 'slug' => 'unread', 'parent_url' => $notifications_link, 'parent_slug' => $slug, 'screen_function' => 'bp_notifications_screen_unread', 'position' => 10, 'item_css_id' => 'notifications-my-notifications', 'user_has_access' => $access);
     $sub_nav[] = array('name' => _x('Read', 'Notification screen nav', 'buddypress'), 'slug' => 'read', 'parent_url' => $notifications_link, 'parent_slug' => $slug, 'screen_function' => 'bp_notifications_screen_read', 'position' => 20, 'user_has_access' => $access);
     parent::setup_nav($main_nav, $sub_nav);
 }
Пример #2
0
 /**
  * Setup BuddyBar navigation
  */
 function setup_nav()
 {
     // Define local variable
     $sub_nav = array();
     // Add the settings navigation item
     $main_nav = array('name' => __('Settings', 'buddypress'), 'slug' => $this->slug, 'position' => 100, 'show_for_displayed_user' => bp_core_can_edit_settings(), 'screen_function' => 'bp_settings_screen_general', 'default_subnav_slug' => 'general');
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     $settings_link = trailingslashit($user_domain . $this->slug);
     // Add General Settings nav item
     $sub_nav[] = array('name' => __('General', 'buddypress'), 'slug' => 'general', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_general', 'position' => 10, 'user_has_access' => bp_core_can_edit_settings());
     // Add Notifications nav item
     $sub_nav[] = array('name' => __('Notifications', 'buddypress'), 'slug' => 'notifications', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_notification', 'position' => 20, 'user_has_access' => bp_core_can_edit_settings());
     // Add Spam Account nav item
     if (bp_current_user_can('bp_moderate')) {
         $sub_nav[] = array('name' => __('Capabilities', 'buddypress'), 'slug' => 'capabilities', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_capabilities', 'position' => 80, 'user_has_access' => !bp_is_my_profile());
     }
     // Add Delete Account nav item
     if (!bp_disable_account_deletion() || bp_current_user_can('delete_users')) {
         $sub_nav[] = array('name' => __('Delete Account', 'buddypress'), 'slug' => 'delete-account', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_settings_screen_delete_account', 'position' => 90, 'user_has_access' => bp_is_my_profile() || !is_super_admin(bp_displayed_user_id()));
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
Пример #3
0
 /**
  * Set up navigation.
  *
  * @param array $main_nav Array of main nav items.
  * @param array $sub_nav  Array of sub nav items.
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     $access = bp_core_can_edit_settings();
     $slug = bp_get_settings_slug();
     $settings_link = trailingslashit($user_domain . $slug);
     // Add the settings navigation item
     $main_nav = array('name' => __('Settings', 'buddypress'), 'slug' => $slug, 'position' => 100, 'show_for_displayed_user' => $access, 'screen_function' => 'bp_settings_screen_general', 'default_subnav_slug' => 'general');
     // Add General Settings nav item
     $sub_nav[] = array('name' => __('General', 'buddypress'), 'slug' => 'general', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_general', 'position' => 10, 'user_has_access' => $access);
     // Add Email nav item. Formerly called 'Notifications', we
     // retain the old slug and function names for backward compat
     $sub_nav[] = array('name' => __('Email', 'buddypress'), 'slug' => 'notifications', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_notification', 'position' => 20, 'user_has_access' => $access);
     // Add Spam Account nav item
     if (bp_current_user_can('bp_moderate')) {
         $sub_nav[] = array('name' => __('Capabilities', 'buddypress'), 'slug' => 'capabilities', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_capabilities', 'position' => 80, 'user_has_access' => !bp_is_my_profile());
     }
     // Add Delete Account nav item
     if (!bp_disable_account_deletion() && bp_is_my_profile() || bp_current_user_can('delete_users')) {
         $sub_nav[] = array('name' => __('Delete Account', 'buddypress'), 'slug' => 'delete-account', 'parent_url' => $settings_link, 'parent_slug' => $slug, 'screen_function' => 'bp_settings_screen_delete_account', 'position' => 90, 'user_has_access' => !is_super_admin(bp_displayed_user_id()));
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
 /**
  * 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);
 }
/**
 * Adds feedback messages when successfully saving profile field settings.
 *
 * @since 2.0.0
 *
 * @uses bp_core_add_message()
 * @uses bp_is_my_profile()
 */
function bp_xprofile_settings_add_feedback_message()
{
    // Default message type is success.
    $type = 'success';
    $message = __('Your profile settings have been saved.', 'buddypress');
    // Community moderator editing another user's settings.
    if (!bp_is_my_profile() && bp_core_can_edit_settings()) {
        $message = __("This member's profile settings have been saved.", 'buddypress');
    }
    // Add the message.
    bp_core_add_message($message, $type);
}
 /**
  * Create a tab on member profile pages
  */
 public function profile_tab()
 {
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     $parent_url = trailingslashit($user_domain . $this->slug);
     $nav_text = __('Papers', 'social-paper');
     // create primary nav
     bp_core_new_nav_item(array('name' => $nav_text, 'slug' => $this->slug, 'item_css_id' => 'user-papers', 'show_for_displayed_user' => true, 'site_admin_only' => false, 'position' => $this->position, 'screen_function' => 'cacsp_profile_screen', 'default_subnav_slug' => $this->published_slug));
     // create subnav items
     bp_core_new_subnav_item(array('name' => __('Published', 'social-paper'), 'slug' => $this->published_slug, 'parent_url' => $parent_url, 'parent_slug' => $this->slug, 'screen_function' => 'cacsp_profile_screen_published', 'position' => 10));
     bp_core_new_subnav_item(array('name' => __('Drafts', 'social-paper'), 'slug' => $this->drafts_slug, 'parent_url' => $parent_url, 'parent_slug' => $this->slug, 'screen_function' => 'cacsp_profile_screen_draft', 'position' => 10, 'user_has_access' => bp_core_can_edit_settings()));
 }
 /**
  * Setup BuddyBar navigation
  *
  * @global BuddyPress $bp The one true BuddyPress instance
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     global $bp;
     $sub_nav = array();
     // Add 'Friends' to the main navigation
     $main_nav = array('name' => sprintf(__('Friends <span>%d</span>', 'buddypress'), friends_get_total_friend_count()), 'slug' => $this->slug, 'position' => 60, 'screen_function' => 'friends_screen_my_friends', 'default_subnav_slug' => 'my-friends', 'item_css_id' => $bp->friends->id);
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     $friends_link = trailingslashit($user_domain . bp_get_friends_slug());
     // Add the subnav items to the friends nav item
     $sub_nav[] = array('name' => __('Friendships', 'buddypress'), 'slug' => 'my-friends', 'parent_url' => $friends_link, 'parent_slug' => bp_get_friends_slug(), 'screen_function' => 'friends_screen_my_friends', 'position' => 10, 'item_css_id' => 'friends-my-friends');
     $sub_nav[] = array('name' => __('Requests', 'buddypress'), 'slug' => 'requests', 'parent_url' => $friends_link, 'parent_slug' => bp_get_friends_slug(), 'screen_function' => 'friends_screen_requests', 'position' => 20, 'user_has_access' => bp_core_can_edit_settings());
     parent::setup_nav($main_nav, $sub_nav);
 }
function wpmudev_chat_buddypress_settings_setup_nav()
{
    global $wpmudev_chat;
    $slug_parent = 'settings';
    $slug_page = 'chat';
    // Set thsi so when we get to wp_footer it knows we need to load the JS/CSS for the Friends display.
    $wpmudev_chat->_chat_plugin_settings['blocked_urls']['front'] = false;
    // Determine user to use
    if (bp_displayed_user_domain()) {
        $user_domain = bp_displayed_user_domain();
    } elseif (bp_loggedin_user_domain()) {
        $user_domain = bp_loggedin_user_domain();
    } else {
        return;
    }
    //echo "user_domain=[". $user_domain ."]<br />";
    $settings_link = trailingslashit($user_domain . $slug_parent);
    //echo "settings_link=[". $settings_link ."]<br />";
    $sub_nav = array('name' => __('Chat', $wpmudev_chat->translation_domain), 'slug' => $slug_page, 'parent_url' => $settings_link, 'parent_slug' => $slug_parent, 'screen_function' => 'wpmudev_chat_settings_screen_chat_proc', 'position' => 30, 'user_has_access' => bp_core_can_edit_settings());
    bp_core_new_subnav_item($sub_nav);
}
Пример #9
0
 /**
  * Setup BuddyBar navigation
  *
  * @global obj $bp
  */
 function setup_nav()
 {
     global $bp;
     // Add the settings navigation item
     $main_nav = array('name' => __('Settings', 'buddypress'), 'slug' => $this->slug, 'position' => 100, 'show_for_displayed_user' => bp_core_can_edit_settings(), 'screen_function' => 'bp_core_screen_general_settings', 'default_subnav_slug' => 'general');
     // Determine user to use
     if (isset($bp->displayed_user->domain)) {
         $user_domain = $bp->displayed_user->domain;
     } elseif (isset($bp->loggedin_user->domain)) {
         $user_domain = $bp->loggedin_user->domain;
     } else {
         return;
     }
     $settings_link = trailingslashit($user_domain . $this->slug);
     // Add General Settings nav item
     $sub_nav[] = array('name' => __('General', 'buddypress'), 'slug' => 'general', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_core_screen_general_settings', 'position' => 10, 'user_has_access' => bp_core_can_edit_settings());
     // Add Notifications nav item
     $sub_nav[] = array('name' => __('Notifications', 'buddypress'), 'slug' => 'notifications', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_core_screen_notification_settings', 'position' => 20, 'user_has_access' => bp_core_can_edit_settings());
     // Add Delete Account nav item
     if (!bp_current_user_can('bp_moderate') && empty($bp->site_options['bp-disable-account-deletion'])) {
         $sub_nav[] = array('name' => __('Delete Account', 'buddypress'), 'slug' => 'delete-account', 'parent_url' => $settings_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_core_screen_delete_account', 'position' => 90, 'user_has_access' => bp_is_my_profile());
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
 /**
  * Setup BuddyBar navigation
  *
  * @global BuddyPress $bp The one true BuddyPress instance
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     $sub_nav = array();
     $name = sprintf(__('Messages <span>%s</span>', 'buddypress'), bp_get_total_unread_messages_count());
     // Add 'Messages' to the main navigation
     $main_nav = array('name' => $name, 'slug' => $this->slug, 'position' => 50, 'show_for_displayed_user' => false, 'screen_function' => 'messages_screen_inbox', 'default_subnav_slug' => 'inbox', 'item_css_id' => $this->id);
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     // Link to user messages
     $messages_link = trailingslashit($user_domain . $this->slug);
     // Add the subnav items to the profile
     $sub_nav[] = array('name' => __('Inbox', 'buddypress'), 'slug' => 'inbox', 'parent_url' => $messages_link, 'parent_slug' => $this->slug, 'screen_function' => 'messages_screen_inbox', 'position' => 10, 'user_has_access' => bp_core_can_edit_settings());
     $sub_nav[] = array('name' => __('Sent', 'buddypress'), 'slug' => 'sentbox', 'parent_url' => $messages_link, 'parent_slug' => $this->slug, 'screen_function' => 'messages_screen_sentbox', 'position' => 20, 'user_has_access' => bp_core_can_edit_settings());
     $sub_nav[] = array('name' => __('Compose', 'buddypress'), 'slug' => 'compose', 'parent_url' => $messages_link, 'parent_slug' => $this->slug, 'screen_function' => 'messages_screen_compose', 'position' => 30, 'user_has_access' => bp_core_can_edit_settings());
     if (bp_current_user_can('bp_moderate')) {
         $sub_nav[] = array('name' => __('Notices', 'buddypress'), 'slug' => 'notices', 'parent_url' => $messages_link, 'parent_slug' => $this->slug, 'screen_function' => 'messages_screen_notices', 'position' => 90, 'user_has_access' => bp_current_user_can('bp_moderate'));
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
 /**
  * Setup BuddyBar navigation
  *
  * @global BuddyPress $bp The one true BuddyPress instance
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Define local variables
     $sub_nav = array();
     // Add 'Groups' to the main navigation
     $main_nav = array('name' => sprintf(__('Groups <span>%d</span>', 'buddypress'), bp_get_total_group_count_for_user()), 'slug' => $this->slug, 'position' => 70, 'screen_function' => 'groups_screen_my_groups', 'default_subnav_slug' => 'my-groups', 'item_css_id' => $this->id);
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         $user_domain = false;
     }
     if (!empty($user_domain)) {
         $groups_link = trailingslashit($user_domain . $this->slug);
         // Add the My Groups nav item
         $sub_nav[] = array('name' => __('Memberships', 'buddypress'), 'slug' => 'my-groups', 'parent_url' => $groups_link, 'parent_slug' => $this->slug, 'screen_function' => 'groups_screen_my_groups', 'position' => 10, 'item_css_id' => 'groups-my-groups');
         // Add the Group Invites nav item
         $sub_nav[] = array('name' => __('Invitations', 'buddypress'), 'slug' => 'invites', 'parent_url' => $groups_link, 'parent_slug' => $this->slug, 'screen_function' => 'groups_screen_group_invites', 'user_has_access' => bp_core_can_edit_settings(), 'position' => 30);
         parent::setup_nav($main_nav, $sub_nav);
     }
     if (bp_is_groups_component() && bp_is_single_item()) {
         // Reset sub nav
         $sub_nav = array();
         // Add 'Groups' to the main navigation
         $main_nav = array('name' => __('Memberships', 'buddypress'), 'slug' => $this->current_group->slug, 'position' => -1, 'screen_function' => 'groups_screen_group_home', 'default_subnav_slug' => $this->default_extension, 'item_css_id' => $this->id);
         $group_link = bp_get_group_permalink($this->current_group);
         // Add the "Home" subnav item, as this will always be present
         $sub_nav[] = array('name' => _x('Home', 'Group home navigation title', 'buddypress'), 'slug' => 'home', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_home', 'position' => 10, 'item_css_id' => 'home');
         // If this is a private group, and the user is not a member, show a "Request Membership" nav item.
         if (is_user_logged_in() && !bp_current_user_can('bp_moderate') && !$this->current_group->is_user_member && !groups_check_for_membership_request(bp_loggedin_user_id(), $this->current_group->id) && $this->current_group->status == 'private') {
             $sub_nav[] = array('name' => __('Request Membership', 'buddypress'), 'slug' => 'request-membership', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_request_membership', 'position' => 30);
         }
         // Forums are enabled and turned on
         if ($this->current_group->enable_forum && bp_is_active('forums')) {
             $sub_nav[] = array('name' => __('Forum', 'buddypress'), 'slug' => 'forum', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_forum', 'position' => 40, 'user_has_access' => $this->current_group->user_has_access, 'item_css_id' => 'forums');
         }
         $sub_nav[] = array('name' => sprintf(__('Members <span>%s</span>', 'buddypress'), number_format($this->current_group->total_member_count)), 'slug' => 'members', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_members', 'position' => 60, 'user_has_access' => $this->current_group->user_has_access, 'item_css_id' => 'members');
         if (bp_is_active('friends') && bp_groups_user_can_send_invites()) {
             $sub_nav[] = array('name' => __('Send Invites', 'buddypress'), 'slug' => 'send-invites', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_invite', 'item_css_id' => 'invite', 'position' => 70, 'user_has_access' => $this->current_group->user_has_access);
         }
         // If the user is a group admin, then show the group admin nav item
         if (bp_is_item_admin()) {
             $sub_nav[] = array('name' => __('Admin', 'buddypress'), 'slug' => 'admin', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_admin', 'position' => 1000, 'user_has_access' => true, 'item_css_id' => 'admin');
         }
         parent::setup_nav($main_nav, $sub_nav);
     }
     if (isset($this->current_group->user_has_access)) {
         do_action('groups_setup_nav', $this->current_group->user_has_access);
     } else {
         do_action('groups_setup_nav');
     }
 }
Пример #12
0
/**
 * AJAX callback to set a message's star status.
 *
 * @since BuddyPress (2.3.0)
 */
function bp_legacy_theme_ajax_messages_star_handler()
{
    if (false === bp_is_active('messages', 'star') || empty($_POST['message_id'])) {
        return;
    }
    // Check nonce
    check_ajax_referer('bp-messages-star-' . (int) $_POST['message_id'], 'nonce');
    // Check capability
    if (!is_user_logged_in() || !bp_core_can_edit_settings()) {
        return;
    }
    if (true === bp_messages_star_set_action(array('action' => $_POST['star_status'], 'message_id' => (int) $_POST['message_id'], 'bulk' => !empty($_POST['bulk']) ? true : false))) {
        echo '1';
        die;
    }
    echo '-1';
    die;
}
Пример #13
0
 /**
  * Set up navigation for user pages.
  *
  * @param array $main_nav See {BP_Component::setup_nav()} for details.
  * @param array $sub_nav  See {BP_Component::setup_nav()} for details.
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     $access = bp_core_can_edit_settings();
     $slug = bp_get_messages_slug();
     $messages_link = trailingslashit($user_domain . $slug);
     // Only grab count if we're on a user page and current user has access
     if (bp_is_user() && bp_user_has_access()) {
         $count = bp_get_total_unread_messages_count();
         $class = 0 === $count ? 'no-count' : 'count';
         $nav_name = sprintf(__('Messages <span class="%s">%s</span>', 'buddypress'), esc_attr($class), bp_core_number_format($count));
     } else {
         $nav_name = __('Messages', 'buddypress');
     }
     // Add 'Messages' to the main navigation
     $main_nav = array('name' => $nav_name, 'slug' => $slug, 'position' => 50, 'show_for_displayed_user' => $access, 'screen_function' => 'messages_screen_inbox', 'default_subnav_slug' => 'inbox', 'item_css_id' => $this->id);
     // Add the subnav items to the profile
     $sub_nav[] = array('name' => __('Inbox', 'buddypress'), 'slug' => 'inbox', 'parent_url' => $messages_link, 'parent_slug' => $slug, 'screen_function' => 'messages_screen_inbox', 'position' => 10, 'user_has_access' => $access);
     if (bp_is_active($this->id, 'star')) {
         $sub_nav[] = array('name' => __('Starred', 'buddypress'), 'slug' => bp_get_messages_starred_slug(), 'parent_url' => $messages_link, 'parent_slug' => $slug, 'screen_function' => 'bp_messages_star_screen', 'position' => 11, 'user_has_access' => $access);
     }
     $sub_nav[] = array('name' => __('Sent', 'buddypress'), 'slug' => 'sentbox', 'parent_url' => $messages_link, 'parent_slug' => $slug, 'screen_function' => 'messages_screen_sentbox', 'position' => 20, 'user_has_access' => $access);
     $sub_nav[] = array('name' => __('Compose', 'buddypress'), 'slug' => 'compose', 'parent_url' => $messages_link, 'parent_slug' => $slug, 'screen_function' => 'messages_screen_compose', 'position' => 30, 'user_has_access' => $access);
     if (bp_current_user_can('bp_moderate')) {
         $sub_nav[] = array('name' => __('Notices', 'buddypress'), 'slug' => 'notices', 'parent_url' => $messages_link, 'parent_slug' => $slug, 'screen_function' => 'messages_screen_notices', 'position' => 90, 'user_has_access' => true);
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
Пример #14
0
 /**
  * Set up component navigation.
  *
  * @since 1.5.0
  *
  * @see BP_Component::setup_nav() for a description of arguments.
  *
  * @param array $main_nav Optional. See BP_Component::setup_nav() for description.
  * @param array $sub_nav  Optional. See BP_Component::setup_nav() for description.
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Determine user to use.
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         $user_domain = false;
     }
     // Only grab count if we're on a user page.
     if (bp_is_user()) {
         $count = bp_get_total_group_count_for_user();
         $class = 0 === $count ? 'no-count' : 'count';
         $nav_name = sprintf(_x('Groups <span class="%s">%s</span>', 'Group screen nav with counter', 'buddypress'), esc_attr($class), bp_core_number_format($count));
     } else {
         $nav_name = _x('Groups', 'Group screen nav without counter', 'buddypress');
     }
     $slug = bp_get_groups_slug();
     // Add 'Groups' to the main navigation.
     $main_nav = array('name' => $nav_name, 'slug' => $slug, 'position' => 70, 'screen_function' => 'groups_screen_my_groups', 'default_subnav_slug' => 'my-groups', 'item_css_id' => $this->id);
     if (!empty($user_domain)) {
         $access = bp_core_can_edit_settings();
         $groups_link = trailingslashit($user_domain . $slug);
         // Add the My Groups nav item.
         $sub_nav[] = array('name' => __('Memberships', 'buddypress'), 'slug' => 'my-groups', 'parent_url' => $groups_link, 'parent_slug' => $slug, 'screen_function' => 'groups_screen_my_groups', 'position' => 10, 'item_css_id' => 'groups-my-groups');
         // Add the Group Invites nav item.
         $sub_nav[] = array('name' => __('Invitations', 'buddypress'), 'slug' => 'invites', 'parent_url' => $groups_link, 'parent_slug' => $slug, 'screen_function' => 'groups_screen_group_invites', 'user_has_access' => $access, 'position' => 30);
         parent::setup_nav($main_nav, $sub_nav);
     }
     if (bp_is_groups_component() && bp_is_single_item()) {
         // Reset sub nav.
         $sub_nav = array();
         // Add 'Groups' to the main navigation.
         $main_nav = array('name' => __('Memberships', 'buddypress'), 'slug' => $this->current_group->slug, 'position' => -1, 'screen_function' => 'groups_screen_group_home', 'default_subnav_slug' => $this->default_extension, 'item_css_id' => $this->id);
         $group_link = bp_get_group_permalink($this->current_group);
         // Add the "Home" subnav item, as this will always be present.
         $sub_nav[] = array('name' => _x('Home', 'Group screen navigation title', 'buddypress'), 'slug' => 'home', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_home', 'position' => 10, 'item_css_id' => 'home');
         // If this is a private group, and the user is not a
         // member and does not have an outstanding invitation,
         // show a "Request Membership" nav item.
         if (is_user_logged_in() && !$this->current_group->is_user_member && !groups_check_for_membership_request(bp_loggedin_user_id(), $this->current_group->id) && $this->current_group->status == 'private' && !groups_check_user_has_invite(bp_loggedin_user_id(), $this->current_group->id)) {
             $sub_nav[] = array('name' => _x('Request Membership', 'Group screen nav', 'buddypress'), 'slug' => 'request-membership', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_request_membership', 'position' => 30);
         }
         // Forums are enabled and turned on.
         if ($this->current_group->enable_forum && bp_is_active('forums')) {
             $sub_nav[] = array('name' => _x('Forum', 'My Group screen nav', 'buddypress'), 'slug' => 'forum', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_forum', 'position' => 40, 'user_has_access' => $this->current_group->user_has_access, 'item_css_id' => 'forums');
         }
         if ($this->current_group->front_template || bp_is_active('activity')) {
             /**
              * If the theme is using a custom front, create activity subnav.
              */
             if ($this->current_group->front_template && bp_is_active('activity')) {
                 $sub_nav[] = array('name' => _x('Activity', 'My Group screen nav', 'buddypress'), 'slug' => 'activity', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_activity', 'position' => 11, 'user_has_access' => $this->current_group->user_has_access, 'item_css_id' => 'activity', 'no_access_url' => $group_link);
             }
             /**
              * Only add the members subnav if it's not the home's nav.
              */
             $sub_nav[] = array('name' => sprintf(_x('Members %s', 'My Group screen nav', 'buddypress'), '<span>' . number_format($this->current_group->total_member_count) . '</span>'), 'slug' => 'members', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_members', 'position' => 60, 'user_has_access' => $this->current_group->user_has_access, 'item_css_id' => 'members', 'no_access_url' => $group_link);
         }
         if (bp_is_active('friends') && bp_groups_user_can_send_invites()) {
             $sub_nav[] = array('name' => _x('Send Invites', 'My Group screen nav', 'buddypress'), 'slug' => 'send-invites', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_invite', 'item_css_id' => 'invite', 'position' => 70, 'user_has_access' => $this->current_group->user_has_access, 'no_access_url' => $group_link);
         }
         // If the user is a group admin, then show the group admin nav item.
         if (bp_is_item_admin()) {
             $sub_nav[] = array('name' => _x('Manage', 'My Group screen nav', 'buddypress'), 'slug' => 'admin', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_admin', 'position' => 1000, 'user_has_access' => true, 'item_css_id' => 'admin', 'no_access_url' => $group_link);
             $admin_link = trailingslashit($group_link . 'admin');
             // Common params to all nav items.
             $default_params = array('parent_url' => $admin_link, 'parent_slug' => $this->current_group->slug . '_manage', 'screen_function' => 'groups_screen_group_admin', 'user_has_access' => bp_is_item_admin(), 'show_in_admin_bar' => true);
             $sub_nav[] = array_merge(array('name' => __('Details', 'buddypress'), 'slug' => 'edit-details', 'position' => 0), $default_params);
             $sub_nav[] = array_merge(array('name' => __('Settings', 'buddypress'), 'slug' => 'group-settings', 'position' => 10), $default_params);
             if (!bp_disable_group_avatar_uploads() && buddypress()->avatar->show_avatars) {
                 $sub_nav[] = array_merge(array('name' => __('Photo', 'buddypress'), 'slug' => 'group-avatar', 'position' => 20), $default_params);
             }
             if (bp_group_use_cover_image_header()) {
                 $sub_nav[] = array_merge(array('name' => __('Cover Image', 'buddypress'), 'slug' => 'group-cover-image', 'position' => 25), $default_params);
             }
             $sub_nav[] = array_merge(array('name' => __('Members', 'buddypress'), 'slug' => 'manage-members', 'position' => 30), $default_params);
             if ('private' == $this->current_group->status) {
                 $sub_nav[] = array_merge(array('name' => __('Requests', 'buddypress'), 'slug' => 'membership-requests', 'position' => 40), $default_params);
             }
             $sub_nav[] = array_merge(array('name' => __('Delete', 'buddypress'), 'slug' => 'delete-group', 'position' => 1000), $default_params);
         }
         parent::setup_nav($main_nav, $sub_nav);
     }
     if (isset($this->current_group->user_has_access)) {
         /**
          * Fires at the end of the groups navigation setup if user has access.
          *
          * @since 1.0.2
          *
          * @param bool $user_has_access Whether or not user has access.
          */
         do_action('groups_setup_nav', $this->current_group->user_has_access);
     } else {
         /** This action is documented in bp-groups/bp-groups-loader.php */
         do_action('groups_setup_nav');
     }
 }
Пример #15
0
 /**
  * Set up the Settings > Profile nav item.
  *
  * Loaded in a separate method because the Settings component may not
  * be loaded in time for BP_XProfile_Component::setup_nav().
  *
  * @since BuddyPress (2.1.0)
  */
 public function setup_settings_nav()
 {
     if (!bp_is_active('settings')) {
         return;
     }
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     // Get the settings slug
     $settings_slug = bp_get_settings_slug();
     bp_core_new_subnav_item(array('name' => _x('Profile Visibility', 'Profile settings sub nav', 'buddypress'), 'slug' => 'profile', 'parent_url' => trailingslashit($user_domain . $settings_slug), 'parent_slug' => $settings_slug, 'screen_function' => 'bp_xprofile_screen_settings', 'position' => 30, 'user_has_access' => bp_core_can_edit_settings()));
 }
Пример #16
0
<?php

/**
 * BuddyPress - Users Settings
 *
 * @package BuddyPress
 * @subpackage bp-legacy
 */
?>

<div class="item-list-tabs no-ajax" id="subnav" role="navigation">
	<ul class="nav nav-pills" id="nav-sub">
		<?php 
if (bp_core_can_edit_settings()) {
    ?>

			<?php 
    bp_get_options_nav();
    ?>

		<?php 
}
?>
	</ul>
</div>

<?php 
switch (bp_current_action()) {
    case 'notifications':
        bp_get_template_part('members/single/settings/notifications');
        break;
Пример #17
0
/**
 * Get the items registered in the primary and secondary BuddyPress navigation menus.
 *
 * @since 1.7.0
 *
 * @return array A multidimensional array of all navigation items.
 */
function bp_get_nav_menu_items()
{
    $menus = $selected_menus = array();
    // Get the second level menus.
    foreach ((array) buddypress()->bp_options_nav as $parent_menu => $sub_menus) {
        // The root menu's ID is "xprofile", but the Profile submenus are using "profile". See BP_Core::setup_nav().
        if ('profile' === $parent_menu) {
            $parent_menu = 'xprofile';
        }
        // Sort the items in this menu's navigation by their position property.
        $second_level_menus = (array) $sub_menus;
        usort($second_level_menus, '_bp_nav_menu_sort');
        // Iterate through the second level menus.
        foreach ($second_level_menus as $sub_nav) {
            // Skip items we don't have access to.
            if (empty($sub_nav['user_has_access'])) {
                continue;
            }
            // Add this menu.
            $menu = new stdClass();
            $menu->class = array('menu-child');
            $menu->css_id = $sub_nav['css_id'];
            $menu->link = $sub_nav['link'];
            $menu->name = $sub_nav['name'];
            $menu->parent = $parent_menu;
            // Associate this sub nav with a top-level menu.
            // If we're viewing this item's screen, record that we need to mark its parent menu to be selected.
            if ($sub_nav['slug'] == bp_current_action()) {
                $menu->class[] = 'current-menu-item';
                $selected_menus[] = $parent_menu;
            }
            $menus[] = $menu;
        }
    }
    // Get the top-level menu parts (Friends, Groups, etc) and sort by their position property.
    $top_level_menus = (array) buddypress()->bp_nav;
    usort($top_level_menus, '_bp_nav_menu_sort');
    // Iterate through the top-level menus.
    foreach ($top_level_menus as $nav) {
        // Skip items marked as user-specific if you're not on your own profile.
        if (empty($nav['show_for_displayed_user']) && !bp_core_can_edit_settings()) {
            continue;
        }
        // Get the correct menu link. See https://buddypress.trac.wordpress.org/ticket/4624.
        $link = bp_loggedin_user_domain() ? str_replace(bp_loggedin_user_domain(), bp_displayed_user_domain(), $nav['link']) : trailingslashit(bp_displayed_user_domain() . $nav['link']);
        // Add this menu.
        $menu = new stdClass();
        $menu->class = array('menu-parent');
        $menu->css_id = $nav['css_id'];
        $menu->link = $link;
        $menu->name = $nav['name'];
        $menu->parent = 0;
        // Check if we need to mark this menu as selected.
        if (in_array($nav['css_id'], $selected_menus)) {
            $menu->class[] = 'current-menu-parent';
        }
        $menus[] = $menu;
    }
    /**
     * Filters the items registered in the primary and secondary BuddyPress navigation menus.
     *
     * @since 1.7.0
     *
     * @param array $menus Array of items registered in the primary and secondary BuddyPress navigation.
     */
    return apply_filters('bp_get_nav_menu_items', $menus);
}
/**
 * Bulk manage handler to set the star status for multiple messages.
 *
 * @since 2.3.0
 */
function bp_messages_star_bulk_manage_handler()
{
    if (empty($_POST['messages_bulk_nonce'])) {
        return;
    }
    // Check the nonce.
    if (!wp_verify_nonce($_POST['messages_bulk_nonce'], 'messages_bulk_nonce')) {
        return;
    }
    // Check capability.
    if (!is_user_logged_in() || !bp_core_can_edit_settings()) {
        return;
    }
    $action = !empty($_POST['messages_bulk_action']) ? $_POST['messages_bulk_action'] : '';
    $threads = !empty($_POST['message_ids']) ? $_POST['message_ids'] : '';
    $threads = wp_parse_id_list($threads);
    // Bail if action doesn't match our star actions or no IDs.
    if (false === in_array($action, array('star', 'unstar'), true) || empty($threads)) {
        return;
    }
    // It's star time!
    switch ($action) {
        case 'star':
            $count = count($threads);
            // If we're starring a thread, we only star the first message in the thread.
            foreach ($threads as $thread) {
                $thread = new BP_Messages_thread($thread);
                $mids = wp_list_pluck($thread->messages, 'id');
                bp_messages_star_set_action(array('action' => 'star', 'message_id' => $mids[0]));
            }
            bp_core_add_message(sprintf(_n('%s message was successfully starred', '%s messages were successfully starred', $count, 'buddypress'), $count));
            break;
        case 'unstar':
            $count = count($threads);
            foreach ($threads as $thread) {
                bp_messages_star_set_action(array('action' => 'unstar', 'thread_id' => $thread, 'bulk' => true));
            }
            bp_core_add_message(sprintf(_n('%s message was successfully unstarred', '%s messages were successfully unstarred', $count, 'buddypress'), $count));
            break;
    }
    // Redirect back to message box.
    bp_core_redirect(bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() . '/');
    die;
}
 /**
  * Set up component navigation.
  *
  * @since 1.5.0
  *
  * @see BP_Component::setup_nav() for a description of arguments.
  *
  * @param array $main_nav Optional. See BP_Component::setup_nav() for
  *                        description.
  * @param array $sub_nav  Optional. See BP_Component::setup_nav() for
  *                        description.
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Determine user to use.
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     $access = bp_core_can_edit_settings();
     $slug = bp_get_friends_slug();
     $friends_link = trailingslashit($user_domain . $slug);
     // Add 'Friends' to the main navigation.
     $count = friends_get_total_friend_count();
     $class = 0 === $count ? 'no-count' : 'count';
     $main_nav = array('name' => sprintf(__('Friends <span class="%s">%s</span>', 'buddypress'), esc_attr($class), bp_core_number_format($count)), 'slug' => $slug, 'position' => 60, 'screen_function' => 'friends_screen_my_friends', 'default_subnav_slug' => 'my-friends', 'item_css_id' => $this->id);
     // Add the subnav items to the friends nav item.
     $sub_nav[] = array('name' => _x('Friendships', 'Friends screen sub nav', 'buddypress'), 'slug' => 'my-friends', 'parent_url' => $friends_link, 'parent_slug' => $slug, 'screen_function' => 'friends_screen_my_friends', 'position' => 10, 'item_css_id' => 'friends-my-friends');
     $sub_nav[] = array('name' => _x('Requests', 'Friends screen sub nav', 'buddypress'), 'slug' => 'requests', 'parent_url' => $friends_link, 'parent_slug' => $slug, 'screen_function' => 'friends_screen_requests', 'position' => 20, 'user_has_access' => $access);
     parent::setup_nav($main_nav, $sub_nav);
 }
function bp_comp_settings_submenu()
{
    global $bp;
    $bp_compliment_can_see_others_comp_value = esc_attr(get_option('bp_compliment_can_see_others_comp'));
    $bp_compliment_can_see_others_comp = $bp_compliment_can_see_others_comp_value ? $bp_compliment_can_see_others_comp_value : 'yes';
    if ($bp_compliment_can_see_others_comp == 'members_choice') {
        if (!bp_is_active('settings')) {
            return;
        }
        if (bp_displayed_user_domain()) {
            $user_domain = bp_displayed_user_domain();
        } elseif (bp_loggedin_user_domain()) {
            $user_domain = bp_loggedin_user_domain();
        } else {
            $user_domain = null;
        }
        // Get the settings slug
        $settings_slug = bp_get_settings_slug();
        bp_core_new_subnav_item(array('name' => __('Compliments', 'bp-compliments'), 'slug' => 'compliments', 'parent_url' => trailingslashit($user_domain . $settings_slug), 'parent_slug' => $settings_slug, 'screen_function' => 'bp_comp_settings_submenu_page_content', 'position' => 20, 'user_has_access' => bp_core_can_edit_settings()));
    }
}
 /**
  * Setup BuddyBar navigation
  *
  * @global BuddyPress $bp The one true BuddyPress instance
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     $sub_nav = array();
     // Add 'Profile' to the main navigation
     $main_nav = array('name' => __('Profile', 'buddypress'), 'slug' => $this->slug, 'position' => 20, 'screen_function' => 'xprofile_screen_display_profile', 'default_subnav_slug' => 'public', 'item_css_id' => $this->id);
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         return;
     }
     $profile_link = trailingslashit($user_domain . $this->slug);
     // Add the subnav items to the profile
     $sub_nav[] = array('name' => __('View', 'buddypress'), 'slug' => 'public', 'parent_url' => $profile_link, 'parent_slug' => $this->slug, 'screen_function' => 'xprofile_screen_display_profile', 'position' => 10);
     // Edit Profile
     $sub_nav[] = array('name' => __('Edit', 'buddypress'), 'slug' => 'edit', 'parent_url' => $profile_link, 'parent_slug' => $this->slug, 'screen_function' => 'xprofile_screen_edit_profile', 'position' => 20, 'user_has_access' => bp_core_can_edit_settings());
     // Change Avatar
     $sub_nav[] = array('name' => __('Change Avatar', 'buddypress'), 'slug' => 'change-avatar', 'parent_url' => $profile_link, 'parent_slug' => $this->slug, 'screen_function' => 'xprofile_screen_change_avatar', 'position' => 30, 'user_has_access' => bp_core_can_edit_settings());
     parent::setup_nav($main_nav, $sub_nav);
 }
Пример #22
0
 /**
  * Set up component navigation.
  *
  * @since BuddyPress (1.5.0)
  *
  * @see BP_Component::setup_nav() for a description of arguments.
  *
  * @param array $main_nav Optional. See BP_Component::setup_nav() for
  *        description.
  * @param array $sub_nav Optional. See BP_Component::setup_nav() for
  *        description.
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Only grab count if we're on a user page
     if (bp_is_user()) {
         $count = bp_get_total_group_count_for_user();
         $class = 0 === $count ? 'no-count' : 'count';
         $nav_name = sprintf(_x('Groups <span class="%s">%s</span>', 'Group screen nav with counter', 'buddypress'), esc_attr($class), number_format_i18n($count));
     } else {
         $nav_name = _x('Groups', 'Group screen nav without counter', 'buddypress');
     }
     // Add 'Groups' to the main navigation
     $main_nav = array('name' => $nav_name, 'slug' => $this->slug, 'position' => 70, 'screen_function' => 'groups_screen_my_groups', 'default_subnav_slug' => 'my-groups', 'item_css_id' => $this->id);
     // Determine user to use
     if (bp_displayed_user_domain()) {
         $user_domain = bp_displayed_user_domain();
     } elseif (bp_loggedin_user_domain()) {
         $user_domain = bp_loggedin_user_domain();
     } else {
         $user_domain = false;
     }
     if (!empty($user_domain)) {
         $groups_link = trailingslashit($user_domain . $this->slug);
         // Add the My Groups nav item
         $sub_nav[] = array('name' => __('Memberships', 'buddypress'), 'slug' => 'my-groups', 'parent_url' => $groups_link, 'parent_slug' => $this->slug, 'screen_function' => 'groups_screen_my_groups', 'position' => 10, 'item_css_id' => 'groups-my-groups');
         // Add the Group Invites nav item
         $sub_nav[] = array('name' => __('Invitations', 'buddypress'), 'slug' => 'invites', 'parent_url' => $groups_link, 'parent_slug' => $this->slug, 'screen_function' => 'groups_screen_group_invites', 'user_has_access' => bp_core_can_edit_settings(), 'position' => 30);
         parent::setup_nav($main_nav, $sub_nav);
     }
     if (bp_is_groups_component() && bp_is_single_item()) {
         // Reset sub nav
         $sub_nav = array();
         // Add 'Groups' to the main navigation
         $main_nav = array('name' => __('Memberships', 'buddypress'), 'slug' => $this->current_group->slug, 'position' => -1, 'screen_function' => 'groups_screen_group_home', 'default_subnav_slug' => $this->default_extension, 'item_css_id' => $this->id);
         $group_link = bp_get_group_permalink($this->current_group);
         // Add the "Home" subnav item, as this will always be present
         $sub_nav[] = array('name' => _x('Home', 'Group screen navigation title', 'buddypress'), 'slug' => 'home', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_home', 'position' => 10, 'item_css_id' => 'home');
         // If this is a private group, and the user is not a
         // member and does not have an outstanding invitation,
         // show a "Request Membership" nav item.
         if (is_user_logged_in() && !$this->current_group->is_user_member && !groups_check_for_membership_request(bp_loggedin_user_id(), $this->current_group->id) && $this->current_group->status == 'private' && !groups_check_user_has_invite(bp_loggedin_user_id(), $this->current_group->id)) {
             $sub_nav[] = array('name' => _x('Request Membership', 'Group screen nav', 'buddypress'), 'slug' => 'request-membership', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_request_membership', 'position' => 30);
         }
         // Forums are enabled and turned on
         if ($this->current_group->enable_forum && bp_is_active('forums')) {
             $sub_nav[] = array('name' => _x('Forum', 'My Group screen nav', 'buddypress'), 'slug' => 'forum', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_forum', 'position' => 40, 'user_has_access' => $this->current_group->user_has_access, 'item_css_id' => 'forums');
         }
         $sub_nav[] = array('name' => sprintf(_x('Members <span>%s</span>', 'My Group screen nav', 'buddypress'), number_format($this->current_group->total_member_count)), 'slug' => 'members', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_members', 'position' => 60, 'user_has_access' => $this->current_group->user_has_access, 'item_css_id' => 'members', 'no_access_url' => $group_link);
         if (bp_is_active('friends') && bp_groups_user_can_send_invites()) {
             $sub_nav[] = array('name' => _x('Send Invites', 'My Group screen nav', 'buddypress'), 'slug' => 'send-invites', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_invite', 'item_css_id' => 'invite', 'position' => 70, 'user_has_access' => $this->current_group->user_has_access, 'no_access_url' => $group_link);
         }
         // If the user is a group admin, then show the group admin nav item
         if (bp_is_item_admin()) {
             $sub_nav[] = array('name' => _x('Manage', 'My Group screen nav', 'buddypress'), 'slug' => 'admin', 'parent_url' => $group_link, 'parent_slug' => $this->current_group->slug, 'screen_function' => 'groups_screen_group_admin', 'position' => 1000, 'user_has_access' => true, 'item_css_id' => 'admin', 'no_access_url' => $group_link);
             $admin_link = trailingslashit($group_link . 'admin');
             // Common params to all nav items
             $default_params = array('parent_url' => $admin_link, 'parent_slug' => $this->current_group->slug . '_manage', 'screen_function' => 'groups_screen_group_admin', 'user_has_access' => bp_is_item_admin(), 'show_in_admin_bar' => true);
             $sub_nav[] = array_merge(array('name' => __('Details', 'buddypress'), 'slug' => 'edit-details', 'position' => 0), $default_params);
             $sub_nav[] = array_merge(array('name' => __('Settings', 'buddypress'), 'slug' => 'group-settings', 'position' => 10), $default_params);
             if (!(int) bp_get_option('bp-disable-avatar-uploads') && buddypress()->avatar->show_avatars) {
                 $sub_nav[] = array_merge(array('name' => __('Photo', 'buddypress'), 'slug' => 'group-avatar', 'position' => 20), $default_params);
             }
             $sub_nav[] = array_merge(array('name' => __('Members', 'buddypress'), 'slug' => 'manage-members', 'position' => 30), $default_params);
             if ('private' == $this->current_group->status) {
                 $sub_nav[] = array_merge(array('name' => __('Requests', 'buddypress'), 'slug' => 'membership-requests', 'position' => 40), $default_params);
             }
             $sub_nav[] = array_merge(array('name' => __('Delete', 'buddypress'), 'slug' => 'delete-group', 'position' => 1000), $default_params);
         }
         parent::setup_nav($main_nav, $sub_nav);
     }
     if (isset($this->current_group->user_has_access)) {
         do_action('groups_setup_nav', $this->current_group->user_has_access);
     } else {
         do_action('groups_setup_nav');
     }
 }