Beispiel #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);
 }
Beispiel #2
0
 public static function get_instance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }