Пример #1
0
 /**
  * Setup BuddyBar navigation
  * Sets up user tabs
  * 
  */
 public function setup_nav($main_nav = array(), $main_nav = array())
 {
     // Define local variables
     $sub_nav = array();
     $screen = BuddyBlog_Screens::get_instance();
     //instance of the blog screen
     $total_posts = 0;
     if (bp_is_my_profile()) {
         $total_posts = buddyblog_get_total_posted(bp_displayed_user_id());
     } else {
         $total_posts = buddyblog_get_total_published_posts(bp_displayed_user_id());
     }
     //
     // Add 'Blog' to the main navigation
     $main_nav = array('name' => sprintf(__('Blog <span>%d</span>', 'buddyblog'), $total_posts), 'slug' => $this->slug, 'position' => 70, 'screen_function' => array($screen, 'my_posts'), 'default_subnav_slug' => BUDDYBLOG_ARCHIVE_SLUG, 'item_css_id' => $this->id);
     //whether to link to logged in user or displayed user
     if (!bp_is_my_profile()) {
         $blog_link = trailingslashit(bp_displayed_user_domain() . $this->slug);
     } else {
         $blog_link = trailingslashit(bp_loggedin_user_domain() . $this->slug);
     }
     // Add the Group Invites nav item
     $sub_nav[] = array('name' => __('Posts', 'buddyblog'), 'slug' => BUDDYBLOG_ARCHIVE_SLUG, 'parent_url' => $blog_link, 'parent_slug' => $this->slug, 'screen_function' => array($screen, 'my_posts'), 'position' => 30);
     $sub_nav[] = array('name' => __('New Post', 'buddyblog'), 'slug' => 'edit', 'parent_url' => $blog_link, 'parent_slug' => $this->slug, 'screen_function' => array($screen, 'new_post'), 'user_has_access' => bp_is_my_profile(), 'position' => 30);
     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);
 }
Пример #4
0
 /**
  * GMW Location menu tab
  */
 function setup_nav($main_nav = array(), $sub_nav = array())
 {
     global $bp;
     // Add 'location' to the main navigation
     $main_nav = apply_filters('gmw_fl_setup_nav', array('name' => __('Location', 'GMW'), 'slug' => GMW_FL_SLUG, 'position' => 60, 'screen_function' => array($this, 'screen_functions'), 'default_subnav_slug' => GMW_FL_SLUG), $bp->displayed_user);
     $user_domain = !empty($bp->displayed_user->id) ? $bp->displayed_user->domain : $bp->loggedin_user->domain;
     $gmw_location_link = trailingslashit($user_domain . GMW_FL_SLUG);
     parent::setup_nav($main_nav);
 }
Пример #5
0
 /**
  * Set up navigation
  *
  * @since 1.3
  */
 function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Add 'Example' to the main navigation
     $main_nav = array('name' => __('Projects', 'collabpress'), 'slug' => $this->slug, 'position' => 44, 'screen_function' => array($this, 'template_loader'), 'default_subnav_slug' => 'tasks', 'show_for_displayed_user' => array($this, 'show_tab_for_current_user'));
     $projects_link = trailingslashit(bp_loggedin_user_domain() . $this->slug);
     // Add a few subnav items under the main Example tab
     $sub_nav[] = array('name' => bp_is_my_profile() ? __('My Tasks', 'collabpress') : sprintf(__('%s&#8217s Tasks', 'collabpress'), bp_get_user_firstname()), 'slug' => 'tasks', 'parent_url' => $projects_link, 'parent_slug' => $this->slug, 'screen_function' => array($this, 'template_loader'), 'position' => 10);
     parent::setup_nav($main_nav, $sub_nav);
 }
 /**
  * Setup BuddyBar navigation
  *
  * @global obj $bp
  */
 function setup_nav()
 {
     global $bp;
     // 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);
     $friends_link = trailingslashit($bp->loggedin_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_is_my_profile());
     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);
 }
Пример #8
0
 /**
  * Set the component's navigation 
  */
 public function setup_nav()
 {
     // Main navigation
     $main_nav = array('name' => sprintf(__('Projects <span>%s</span>', 'bp-portfolio'), bp_portfolio_get_user_projects_count(bp_displayed_user_id())), 'slug' => bp_get_portfolio_slug(), 'position' => 80, 'screen_function' => 'bp_portfolio_screen_personal', 'default_subnav_slug' => 'personal');
     $portfolio_link = trailingslashit(bp_loggedin_user_domain() . bp_get_portfolio_slug());
     // Add a few subnav items under the main Portfolio tab
     $sub_nav[] = array('name' => __('Personal', 'bp-portfolio'), 'slug' => 'personal', 'parent_url' => $portfolio_link, 'parent_slug' => bp_get_portfolio_slug(), 'screen_function' => 'bp_portfolio_screen_personal', 'position' => 10);
     if (bp_displayed_user_id() == bp_loggedin_user_id()) {
         // Add a few subnav items under the main Portfolio tab
         $sub_nav[] = array('name' => __('Add', 'bp-portfolio'), 'slug' => 'add', 'parent_url' => $portfolio_link, 'parent_slug' => bp_get_portfolio_slug(), 'screen_function' => 'bp_portfolio_screen_add', 'position' => 20);
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
 /**
  * Setup BuddyBar navigation
  *
  * @global obj $bp
  */
 function setup_nav()
 {
     global $bp;
     // 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);
     $profile_link = trailingslashit($bp->loggedin_user->domain . $this->slug);
     // Add the subnav items to the profile
     $sub_nav[] = array('name' => __('Public', '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);
     // 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);
     parent::setup_nav($main_nav, $sub_nav);
 }
Пример #10
0
 /**
  * Setup BuddyBar navigation
  *
  * @global obj $bp
  */
 function setup_nav()
 {
     global $bp;
     /**
      * Blog/post/comment menus should not appear on single WordPress setups.
      * Although comments and posts made by users will still show on their
      * activity stream.
      */
     if (!is_multisite()) {
         return false;
     }
     // Add 'Sites' to the main navigation
     $main_nav = array('name' => sprintf(__('Sites <span>%d</span>', 'buddypress'), bp_blogs_total_blogs_for_user()), 'slug' => $this->slug, 'position' => 30, 'screen_function' => 'bp_blogs_screen_my_blogs', 'default_subnav_slug' => 'my-blogs', 'item_css_id' => $this->id);
     // Setup navigation
     parent::setup_nav($main_nav);
 }
Пример #11
0
 /**
  * Set up component navigation, and register display callbacks.
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     // Only grab count if we're on a user page.
     $count = 0;
     if (bp_is_user()) {
         $count = $this->humcore_get_user_deposit_count();
     }
     $class = 0 === $count ? 'no-count' : 'count';
     $nav_name = sprintf(__('Deposits <span class="%s">%s</span>', 'humcore_domain'), esc_attr($class), number_format_i18n($count));
     $main_nav = array('name' => $nav_name, 'slug' => $this->slug, 'position' => 35, 'default_subnav_slug' => 'my-deposits', 'screen_function' => array($this, 'screen_function'));
     /** BuddyPress needs to have at least one subnav item, even if
      * it's redundant
      */
     $sub_nav[] = array('name' => __('Deposits', 'humcore_domain'), 'slug' => 'my-deposits', 'parent_slug' => 'deposits', 'parent_url' => bp_displayed_user_domain() . 'deposits/');
     parent::setup_nav($main_nav, $sub_nav);
 }
Пример #12
0
 /**
  * Setup BuddyBar navigation
  *
  * @global obj $bp
  */
 function setup_nav()
 {
     global $bp;
     $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);
     // Link to user messages
     $messages_link = trailingslashit($bp->loggedin_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_is_my_profile());
     $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_is_my_profile());
     $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_is_my_profile());
     if (is_super_admin()) {
         $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' => is_super_admin());
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
 /**
  * Set up bp-checkins navigation.
  */
 function setup_nav()
 {
     global $bp;
     // Add 'Checkins' to the main navigation
     $main_nav = array('name' => __('Checkins', 'bp-checkins'), 'slug' => BP_CHECKINS_SLUG, 'position' => 80, 'screen_function' => 'bp_checkins_my_checkins', 'default_subnav_slug' => 'checkins-area');
     $user_domain = !empty($bp->displayed_user->id) ? $bp->displayed_user->domain : $bp->loggedin_user->domain;
     $checkins_link = trailingslashit($user_domain . BP_CHECKINS_SLUG);
     // Add a few subnav items under the main Example tab
     $sub_nav[] = array('name' => __('Checkins', 'bp-checkins'), 'slug' => 'checkins-area', 'parent_url' => $checkins_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_checkins_my_checkins', 'position' => 10);
     // Add the subnav items to the friends nav item
     $sub_nav[] = array('name' => __('Places', 'bp-checkins'), 'slug' => 'places-area', 'parent_url' => $checkins_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_checkins_my_places', 'position' => 20);
     parent::setup_nav($main_nav, $sub_nav);
     if (bp_checkins_is_foursquare_ready() && bp_is_active('settings')) {
         // Member Settings tab
         bp_core_new_subnav_item(array('name' => __('Checkins settings', 'bp-checkins'), 'slug' => 'checkins-settings', 'parent_slug' => bp_get_settings_slug(), 'parent_url' => trailingslashit(bp_loggedin_user_domain() . bp_get_settings_slug()), 'screen_function' => 'bp_checkins_screen_settings_menu', 'position' => 40, 'user_has_access' => bp_is_my_profile()));
     }
 }
 /**
  * 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);
 }
Пример #15
0
 function setup_nav()
 {
     global $blog_id;
     //check multisite or normal mode for correct permission checking
     if (is_multisite() && $blog_id != BP_ROOT_BLOG) {
         //FIXME MS mode doesn't seem to recognize cross subsite caps, using the proper functions, for now we use switch_blog.
         $current_blog = $blog_id;
         switch_to_blog(BP_ROOT_BLOG);
         $can_manage_events = current_user_can_for_blog(BP_ROOT_BLOG, 'edit_events');
         $can_manage_locations = current_user_can_for_blog(BP_ROOT_BLOG, 'edit_locations');
         $can_manage_bookings = current_user_can_for_blog(BP_ROOT_BLOG, 'manage_bookings');
         switch_to_blog($current_blog);
     } else {
         $can_manage_events = current_user_can('edit_events');
         $can_manage_locations = current_user_can('edit_locations');
         $can_manage_bookings = current_user_can('manage_bookings');
     }
     /* Add 'Events' to the main user profile navigation */
     $main_nav = array('name' => __('Events', 'dbem'), 'slug' => em_bp_get_slug(), 'position' => 80, 'screen_function' => 'bp_em_events', 'default_subnav_slug' => 'profile');
     $em_link = trailingslashit(bp_loggedin_user_domain() . em_bp_get_slug());
     /* Create SubNav Items */
     $sub_nav[] = array('name' => __('My Profile', 'dbem'), 'slug' => 'profile', 'parent_slug' => em_bp_get_slug(), 'parent_url' => $em_link, 'screen_function' => 'bp_em_events', 'position' => 10);
     $sub_nav[] = array('name' => __('Events I\'m Attending', 'dbem'), 'slug' => 'attending', 'parent_slug' => em_bp_get_slug(), 'parent_url' => $em_link, 'screen_function' => 'bp_em_attending', 'position' => 20, 'user_has_access' => bp_is_my_profile());
     if ($can_manage_events) {
         $sub_nav[] = array('name' => __('My Events', 'dbem'), 'slug' => 'my-events', 'parent_slug' => em_bp_get_slug(), 'parent_url' => $em_link, 'screen_function' => 'bp_em_my_events', 'position' => 30, 'user_has_access' => bp_is_my_profile());
     }
     if ($can_manage_locations && get_option('dbem_locations_enabled')) {
         $sub_nav[] = array('name' => __('My Locations', 'dbem'), 'slug' => 'my-locations', 'parent_slug' => em_bp_get_slug(), 'parent_url' => $em_link, 'screen_function' => 'bp_em_my_locations', 'position' => 40, 'user_has_access' => bp_is_my_profile());
     }
     if ($can_manage_bookings && get_option('dbem_rsvp_enabled')) {
         $sub_nav[] = array('name' => __('My Event Bookings', 'dbem'), 'slug' => 'my-bookings', 'parent_slug' => em_bp_get_slug(), 'parent_url' => $em_link, 'screen_function' => 'bp_em_my_bookings', 'position' => 50, 'user_has_access' => bp_is_my_profile());
     }
     if (bp_is_active('groups')) {
         /* Create Profile Group Sub-Nav */
         $sub_nav[] = array('name' => __('Events', 'dbem'), 'slug' => 'group-events', 'parent_slug' => bp_get_groups_slug(), 'parent_url' => trailingslashit(bp_loggedin_user_domain() . bp_get_groups_slug()), 'screen_function' => 'bp_em_my_group_events', 'position' => 60, 'user_has_access' => bp_is_my_profile());
     }
     parent::setup_nav($main_nav, $sub_nav);
     add_action('bp_init', array(&$this, 'setup_group_nav'));
 }
 function setup_nav($main_nav = array(), $sub_nav = array())
 {
     $directWorkflow = isDirectWorkflow();
     $main_nav = array('name' => __('My articles', 'social-articles'), 'slug' => SA_SLUG, 'position' => 100, 'screen_function' => 'social_articles_screen', 'default_subnav_slug' => 'articles');
     $user_domain = bp_is_user() ? bp_displayed_user_domain() : bp_loggedin_user_domain();
     $social_articles_link = trailingslashit($user_domain . SA_SLUG);
     $user_id = bp_is_user() ? bp_displayed_user_id() : bp_loggedin_user_id();
     if (bp_displayed_user_id() == bp_loggedin_user_id()) {
         $publishCount = custom_get_user_posts_count('publish');
         $pendingCount = custom_get_user_posts_count('pending');
         $draftCount = custom_get_user_posts_count('draft');
         $sub_nav[] = array('name' => sprintf(__("Published", "social-articles") . '<span>%d</span>', $publishCount), 'slug' => 'articles', 'parent_url' => $social_articles_link, 'parent_slug' => SA_SLUG, 'screen_function' => 'my_articles_screen', 'position' => 10);
         if (!$directWorkflow) {
             $sub_nav[] = array('name' => sprintf(__("Under Review", "social-articles") . '<span>%d</span>', $pendingCount), 'slug' => 'under-review', 'parent_url' => $social_articles_link, 'parent_slug' => SA_SLUG, 'screen_function' => 'pending_articles_screen', 'position' => 20);
         }
         $sub_nav[] = array('name' => sprintf(__("Draft", "social-articles") . '<span>%d</span>', $draftCount), 'slug' => 'draft', 'parent_url' => $social_articles_link, 'parent_slug' => SA_SLUG, 'screen_function' => 'draft_articles_screen', 'position' => 30);
         $sub_nav[] = array('name' => __('New article', 'social-articles'), 'slug' => 'new', 'parent_url' => $social_articles_link, 'parent_slug' => SA_SLUG, 'screen_function' => 'new_article_screen', 'position' => 40);
     }
     if ($this->check_visibility()) {
         parent::setup_nav($main_nav, $sub_nav);
     }
 }
Пример #17
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);
 }
 /**
  * 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);
 }
Пример #19
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())
 {
     $bp = buddypress();
     // If xprofile component is disabled, revert to WordPress profile
     if (!bp_is_active('xprofile')) {
         // Fallback values if xprofile is disabled
         if (!isset($bp->core->profile)) {
             $bp->core->profile = new stdClass();
         }
         $bp->core->profile->slug = 'profile';
         $bp->active_components[$bp->core->profile->slug] = $bp->core->profile->slug;
         // Add 'Profile' to the main navigation
         $main_nav = array('name' => __('Profile', 'buddypress'), 'slug' => $bp->core->profile->slug, 'position' => 20, 'screen_function' => 'bp_core_catch_profile_uri', 'default_subnav_slug' => 'public');
         $profile_link = trailingslashit(bp_loggedin_user_domain() . '/' . $bp->core->profile->slug);
         // Add the subnav items to the profile
         $sub_nav[] = array('name' => __('View', 'buddypress'), 'slug' => 'public', 'parent_url' => $profile_link, 'parent_slug' => $bp->core->profile->slug, 'screen_function' => 'bp_core_catch_profile_uri');
         parent::setup_nav($main_nav, $sub_nav);
     }
 }
Пример #20
0
 /**
  * Setup BuddyBar navigation
  *
  * @global obj $bp
  */
 function setup_nav()
 {
     global $bp;
     // Add 'Profile' to the main navigation
     if (!bp_is_active('xprofile')) {
         // Don't set up navigation if there's no user
         if (!is_user_logged_in() && !bp_is_user()) {
             return;
         }
         $main_nav = array('name' => __('Profile', 'buddypress'), 'slug' => $bp->profile->slug, 'position' => 20, 'screen_function' => 'bp_members_screen_display_profile', 'default_subnav_slug' => 'public', 'item_css_id' => $bp->profile->id);
         // User links
         $user_domain = isset($bp->displayed_user->domain) ? $bp->displayed_user->domain : $bp->loggedin_user->domain;
         $user_login = isset($bp->displayed_user->userdata->user_login) ? $bp->displayed_user->userdata->user_login : $bp->loggedin_user->userdata->user_login;
         $profile_link = trailingslashit($user_domain . $bp->profile->slug);
         // Add the subnav items to the profile
         $sub_nav[] = array('name' => __('Public', 'buddypress'), 'slug' => 'public', 'parent_url' => $profile_link, 'parent_slug' => $bp->profile->slug, 'screen_function' => 'bp_members_screen_display_profile', 'position' => 10);
         parent::setup_nav($main_nav, $sub_nav);
     }
 }
Пример #21
0
 /**
  * Set up IdeaStream navigation.
  *
  * @package WP Idea Stream
  * @subpackage buddypress/loader
  *
  * @since 2.0.0
  *
  * @uses buddypress() to get BuddyPress instance data
  * @uses bp_loggedin_user_id() to get logged in user id
  * @uses bp_get_loggedin_user_username() to get logged in user nicename
  * @uses bp_loggedin_user_domain() to get logged in user domain
  * @uses bp_is_user() to check if a user's profile is displayed
  * @uses bp_displayed_user_id() to get the displayed user id
  * @uses bp_get_displayed_user_username() to get displayed user nicename
  * @uses bp_displayed_user_domain() to get displayed user profile link
  * @uses wp_idea_stream_users_get_profile_nav_items() to get IdeaStream user nav items
  * @uses sanitize_title(), sanitize_key() to sanitize datas
  */
 public function setup_nav($main_nav = array(), $sub_nav = array())
 {
     $bp = buddypress();
     // Default is current user.
     $user_id = bp_loggedin_user_id();
     $user_nicename = bp_get_loggedin_user_username();
     $user_domain = bp_loggedin_user_domain();
     // If viewing a user, set the user to displayed one
     if (bp_is_user()) {
         $user_id = bp_displayed_user_id();
         $user_nicename = bp_get_displayed_user_username();
         $user_domain = bp_displayed_user_domain();
     }
     // Build the user nav if we have an id
     if (!empty($user_id)) {
         // Build user's ideas BuddyPress profile link
         $profile_link = trailingslashit($user_domain . $this->slug);
         // Get Core User's profile nav
         $user_core_subnav = wp_idea_stream_users_get_profile_nav_items($user_id, $user_nicename);
         // Build BuddyPress user's Main nav
         $main_nav = array('name' => $this->name, 'slug' => $this->slug, 'position' => 90, 'screen_function' => array('WP_Idea_Stream_Screens', 'user_ideas'), 'default_subnav_slug' => sanitize_title($user_core_subnav['profile']['slug'], 'ideas', 'save'));
         // Init nav position & subnav slugs
         $position = 10;
         $this->idea_nav = array();
         // Build BuddyPress user's Sub nav
         foreach ($user_core_subnav as $key => $nav) {
             $fallback_slug = sanitize_key($key);
             if ('profile' == $fallback_slug) {
                 $fallback_slug = 'ideas';
             }
             // Register subnav slugs using the fallback title
             // as keys to easily build urls later on.
             $this->idea_nav[$fallback_slug] = array('name' => $nav['title'], 'slug' => sanitize_title($nav['slug'], $fallback_slug, 'save'));
             $sub_nav[] = array('name' => $this->idea_nav[$fallback_slug]['name'], 'slug' => $this->idea_nav[$fallback_slug]['slug'], 'parent_url' => $profile_link, 'parent_slug' => $this->slug, 'screen_function' => array('WP_Idea_Stream_Screens', 'user_' . $fallback_slug), 'position' => $position);
             // increment next nav position
             $position += 10;
         }
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
 /**
  * Setup BuddyBar navigation
  *
  * @since 1.5.0
  *
  * @global object $bp BuddyPress global settings
  * @uses bp_is_active()
  * @uses is_user_logged_in()
  * @uses bp_get_friends_slug()
  * @uses bp_get_groups_slug()
  */
 function setup_nav()
 {
     global $bp;
     // Add 'Activity' to the main navigation
     $main_nav = array('name' => __('Activity', 'buddypress'), 'slug' => $this->slug, 'position' => 10, 'screen_function' => 'bp_activity_screen_my_activity', 'default_subnav_slug' => 'just-me', 'item_css_id' => $this->id);
     // Stop if there is no user displayed or logged in
     if (!is_user_logged_in() && !isset($bp->displayed_user->id)) {
         return;
     }
     // 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;
     }
     // User link
     $activity_link = trailingslashit($user_domain . $this->slug);
     // Add the subnav items to the activity nav item if we are using a theme that supports this
     $sub_nav[] = array('name' => __('Personal', 'buddypress'), 'slug' => 'just-me', 'parent_url' => $activity_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_activity_screen_my_activity', 'position' => 10);
     // @ mentions
     $sub_nav[] = array('name' => __('Mentions', 'buddypress'), 'slug' => 'mentions', 'parent_url' => $activity_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_activity_screen_mentions', 'position' => 20, 'item_css_id' => 'activity-mentions');
     // Favorite activity items
     $sub_nav[] = array('name' => __('Favorites', 'buddypress'), 'slug' => 'favorites', 'parent_url' => $activity_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_activity_screen_favorites', 'position' => 30, 'item_css_id' => 'activity-favs');
     // Additional menu if friends is active
     if (bp_is_active('friends')) {
         $sub_nav[] = array('name' => __('Friends', 'buddypress'), 'slug' => bp_get_friends_slug(), 'parent_url' => $activity_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_activity_screen_friends', 'position' => 40, 'item_css_id' => 'activity-friends');
     }
     // Additional menu if groups is active
     if (bp_is_active('groups')) {
         $sub_nav[] = array('name' => __('Groups', 'buddypress'), 'slug' => bp_get_groups_slug(), 'parent_url' => $activity_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_activity_screen_groups', 'position' => 50, 'item_css_id' => 'activity-groups');
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
 public function setup_nav($main = array(), $sub = array())
 {
     $bp = buddypress();
     $component = 'members';
     $component_id = mpp_get_current_component_id();
     if (!mpp_is_enabled($component, $component_id)) {
         //allow to disable user galleries in case they don't want it
         return false;
     }
     $view_helper = MPP_Gallery_Screens::get_instance();
     // Add 'Gallery' to the user's main navigation
     $main_nav = array('name' => sprintf(__('Gallery <span>%d</span>', 'mediapress'), mpp_get_total_gallery_for_user()), 'slug' => $this->slug, 'position' => 86, 'screen_function' => array($view_helper, 'user_galleries'), 'default_subnav_slug' => 'my-galleries', 'item_css_id' => $this->id);
     if (bp_is_user()) {
         $user_domain = bp_displayed_user_domain();
     } else {
         $user_domain = bp_loggedin_user_domain();
     }
     $gallery_link = trailingslashit($user_domain . $this->slug);
     //with a trailing slash
     // Add the My Gallery nav item
     $sub_nav[] = array('name' => __('My Gallery', 'mediapress'), 'slug' => 'my-galleries', 'parent_url' => $gallery_link, 'parent_slug' => $this->slug, 'screen_function' => array($view_helper, 'my_galleries'), 'position' => 10, 'item_css_id' => 'gallery-my-gallery');
     if (mpp_user_can_create_gallery($component, get_current_user_id())) {
         // Add the Create gallery link to gallery nav
         $sub_nav[] = array('name' => __('Create a Gallery', 'mediapress'), 'slug' => 'create', 'parent_url' => $gallery_link, 'parent_slug' => $this->slug, 'screen_function' => array($view_helper, 'my_galleries'), 'user_has_access' => bp_is_my_profile(), 'position' => 20);
     }
     if (mpp_component_has_type_filters_enabled($component, $component_id)) {
         $i = 10;
         $supported_types = mpp_component_get_supported_types($component);
         foreach ($supported_types as $type) {
             if (!mpp_is_active_type($type)) {
                 continue;
             }
             $type_object = mpp_get_type_object($type);
             $sub_nav[] = array('name' => $type_object->label, 'slug' => 'type/' . $type, 'parent_url' => $gallery_link, 'parent_slug' => $this->slug, 'screen_function' => array($view_helper, 'my_galleries'), 'position' => 20 + $i);
             $i = $i + 10;
             //increment the position
         }
     }
     // Add the Upload link to gallery nav
     /*$sub_nav[] = array(
           'name'				=> __( 'Upload', 'mediapress'),
           'slug'				=> 'upload',
           'parent_url'		=> $gallery_link,
           'parent_slug'		=> $this->slug,
           'screen_function'	=> array( $view_helper, 'upload_media' ),
           'user_has_access'	=> bp_is_my_profile(),
           'position'			=> 30
       );*/
     parent::setup_nav($main_nav, $sub_nav);
     //disallow these names in various lists
     //we have yet to implement it
     $this->forbidden_names = apply_filters('mpp_forbidden_names', array('gallery', 'galleries', 'my-gallery', 'create', 'delete', 'upload', 'add', 'edit', 'admin', 'request', 'upload', 'tags', 'audio', 'video', 'photo'));
     //use this to extend the valid status
     $this->valid_status = apply_filters('mpp_valid_gallery_status', array_keys(mpp_get_active_statuses()));
     do_action('mpp_setup_nav');
     // $bp->gallery->current_gallery->user_has_access
 }
Пример #24
0
 /**
  * Set up component navigation.
  *
  * @since 1.5.0
  *
  * @see BP_Component::setup_nav() for a description of arguments.
  * @uses bp_is_active()
  * @uses is_user_logged_in()
  * @uses bp_get_friends_slug()
  * @uses bp_get_groups_slug()
  *
  * @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())
 {
     // Stop if there is no user displayed or logged in.
     if (!is_user_logged_in() && !bp_displayed_user_id()) {
         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;
     }
     $slug = bp_get_activity_slug();
     $activity_link = trailingslashit($user_domain . $slug);
     // Add 'Activity' to the main navigation.
     $main_nav = array('name' => _x('Activity', 'Profile activity screen nav', 'buddypress'), 'slug' => $slug, 'position' => 10, 'screen_function' => 'bp_activity_screen_my_activity', 'default_subnav_slug' => 'just-me', 'item_css_id' => $this->id);
     // Add the subnav items to the activity nav item if we are using a theme that supports this.
     $sub_nav[] = array('name' => _x('Personal', 'Profile activity screen sub nav', 'buddypress'), 'slug' => 'just-me', 'parent_url' => $activity_link, 'parent_slug' => $slug, 'screen_function' => 'bp_activity_screen_my_activity', 'position' => 10);
     // Check @mentions.
     if (bp_activity_do_mentions()) {
         $sub_nav[] = array('name' => _x('Mentions', 'Profile activity screen sub nav', 'buddypress'), 'slug' => 'mentions', 'parent_url' => $activity_link, 'parent_slug' => $slug, 'screen_function' => 'bp_activity_screen_mentions', 'position' => 20, 'item_css_id' => 'activity-mentions');
     }
     // Favorite activity items.
     if (bp_activity_can_favorite()) {
         $sub_nav[] = array('name' => _x('Favorites', 'Profile activity screen sub nav', 'buddypress'), 'slug' => 'favorites', 'parent_url' => $activity_link, 'parent_slug' => $slug, 'screen_function' => 'bp_activity_screen_favorites', 'position' => 30, 'item_css_id' => 'activity-favs');
     }
     // Additional menu if friends is active.
     if (bp_is_active('friends')) {
         $sub_nav[] = array('name' => _x('Friends', 'Profile activity screen sub nav', 'buddypress'), 'slug' => bp_get_friends_slug(), 'parent_url' => $activity_link, 'parent_slug' => $slug, 'screen_function' => 'bp_activity_screen_friends', 'position' => 40, 'item_css_id' => 'activity-friends');
     }
     // Additional menu if groups is active.
     if (bp_is_active('groups')) {
         $sub_nav[] = array('name' => _x('Groups', 'Profile activity screen sub nav', 'buddypress'), 'slug' => bp_get_groups_slug(), 'parent_url' => $activity_link, 'parent_slug' => $slug, 'screen_function' => 'bp_activity_screen_groups', 'position' => 50, 'item_css_id' => 'activity-groups');
     }
     parent::setup_nav($main_nav, $sub_nav);
 }
Пример #25
0
 /**
  * Set-up our buddypress navigation which
  * are accesible in members and groups nav
  *
  * @param  array $main_nav The main navigation for groups.
  * @param  array $sub_nav The sub navigation of groups.
  * @return void
  */
 function setup_nav($main_nav = array(), $sub_nav = array())
 {
     $main_nav = array('name' => $this->name, 'slug' => $this->id, 'position' => 80, 'screen_function' => 'task_breaker_bp_projects_main_screen_function', 'default_subnav_slug' => 'all');
     // Add a few subnav items under the main tab.
     $sub_nav[] = array('name' => __('My Projects', 'task_breaker'), 'slug' => 'all', 'parent_url' => bp_loggedin_user_domain() . '' . $this->id . '/', 'parent_slug' => 'projects', 'screen_function' => 'task_breaker_bp_projects_main_screen_function', 'position' => 10);
     // Edit subnav.
     $sub_nav[] = array('name' => __('New Project', 'task_breaker'), 'slug' => 'new', 'parent_url' => bp_loggedin_user_domain() . '' . $this->id . '/', 'parent_slug' => 'projects', 'screen_function' => 'task_breaker_bp_projects_main_screen_function_new_project', 'position' => 10);
     parent::setup_nav($main_nav, $sub_nav);
     return;
 }
Пример #26
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())
 {
     // Stop if forums haven't been set up yet
     if (!bp_forums_is_installed_correctly()) {
         return;
     }
     // Stop if there is no user displayed or logged in
     if (!is_user_logged_in() && !bp_displayed_user_id()) {
         return;
     }
     // Add 'Forums' to the main navigation
     $main_nav = array('name' => __('Forums', 'buddypress'), 'slug' => $this->slug, 'position' => 80, 'screen_function' => 'bp_member_forums_screen_topics', 'default_subnav_slug' => 'topics', '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;
     }
     // User link
     $forums_link = trailingslashit($user_domain . $this->slug);
     // Additional menu if friends is active
     $sub_nav[] = array('name' => __('Topics Started', 'buddypress'), 'slug' => 'topics', 'parent_url' => $forums_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_member_forums_screen_topics', 'position' => 20, 'item_css_id' => 'topics');
     // Additional menu if friends is active
     $sub_nav[] = array('name' => __('Replied To', 'buddypress'), 'slug' => 'replies', 'parent_url' => $forums_link, 'parent_slug' => $this->slug, 'screen_function' => 'bp_member_forums_screen_replies', 'position' => 40, 'item_css_id' => 'replies');
     parent::setup_nav($main_nav, $sub_nav);
 }
Пример #27
0
 /**
  * Set up fall-back component navigation if XProfile is inactive.
  *
  * @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())
 {
     // Bail if XProfile component is active
     if (bp_is_active('xprofile')) {
         return;
     }
     // Don't set up navigation if there's no member
     if (!is_user_logged_in() && !bp_is_user()) {
         return;
     }
     $bp = buddypress();
     // Setup the main navigation
     $main_nav = array('name' => _x('Profile', 'Member profile main navigation', 'buddypress'), 'slug' => $bp->profile->slug, 'position' => 20, 'screen_function' => 'bp_members_screen_display_profile', 'default_subnav_slug' => 'public', 'item_css_id' => $bp->profile->id);
     // User links
     $user_domain = bp_displayed_user_domain() ? bp_displayed_user_domain() : bp_loggedin_user_domain();
     $profile_link = trailingslashit($user_domain . $bp->profile->slug);
     // Setup the subnav items for the member profile
     $sub_nav[] = array('name' => _x('View', 'Member profile view', 'buddypress'), 'slug' => 'public', 'parent_url' => $profile_link, 'parent_slug' => $bp->profile->slug, 'screen_function' => 'bp_members_screen_display_profile', 'position' => 10);
     parent::setup_nav($main_nav, $sub_nav);
 }
Пример #28
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');
     }
 }
Пример #29
0
 /**
  * Set up navigation.
  *
  * @global BuddyPress $bp The one true BuddyPress instance
  */
 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_profile_slug();
     $profile_link = trailingslashit($user_domain . $slug);
     // Add 'Profile' to the main navigation
     $main_nav = array('name' => _x('Profile', 'Profile header menu', 'buddypress'), 'slug' => $slug, 'position' => 20, 'screen_function' => 'xprofile_screen_display_profile', 'default_subnav_slug' => 'public', 'item_css_id' => $this->id);
     // Add the subnav items to the profile
     $sub_nav[] = array('name' => _x('View', 'Profile header sub menu', 'buddypress'), 'slug' => 'public', 'parent_url' => $profile_link, 'parent_slug' => $slug, 'screen_function' => 'xprofile_screen_display_profile', 'position' => 10);
     // Edit Profile
     $sub_nav[] = array('name' => _x('Edit', 'Profile header sub menu', 'buddypress'), 'slug' => 'edit', 'parent_url' => $profile_link, 'parent_slug' => $slug, 'screen_function' => 'xprofile_screen_edit_profile', 'position' => 20, 'user_has_access' => $access);
     // Change Avatar
     if (buddypress()->avatar->show_avatars) {
         $sub_nav[] = array('name' => _x('Change Profile Photo', 'Profile header sub menu', 'buddypress'), 'slug' => 'change-avatar', 'parent_url' => $profile_link, 'parent_slug' => $slug, 'screen_function' => 'xprofile_screen_change_avatar', 'position' => 30, 'user_has_access' => $access);
     }
     // The Settings > Profile nav item can only be set up after
     // the Settings component has run its own nav routine
     add_action('bp_settings_setup_nav', array($this, 'setup_settings_nav'));
     parent::setup_nav($main_nav, $sub_nav);
 }
Пример #30
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);
 }