Exemple #1
0
/**
 * Template tag to output the link to create a new paper.
 *
 * No capability check here.
 */
function cacsp_the_new_paper_link()
{
    echo cacsp_get_the_new_paper_link();
}
    cacsp_get_template_part('loop-social-paper', 'buddypress');
    ?>
			</div>

		<?php 
} else {
    ?>

			<div id="message" class="info">

				<?php 
    if (is_user_logged_in()) {
        ?>

					<p><?php 
        printf(__('No papers have been written yet.  %sBe the first to write a paper!%s', 'social-paper'), '<a href="' . cacsp_get_the_new_paper_link() . '">', '</a>');
        ?>
</p>

				<?php 
    } else {
        ?>

					<p><?php 
        _e('No papers have been written yet.', 'social-paper');
        ?>
</p>

				<?php 
    }
    ?>
 /**
  * Create the "Papers" nav menu in the WP adminbar.
  */
 function adminbar()
 {
     if (!is_user_logged_in()) {
         return;
     }
     $wp_admin_nav = array();
     // Parent nav
     $wp_admin_nav[] = array('parent' => buddypress()->my_account_menu_id, 'id' => 'my-account-' . $this->slug, 'title' => __('Papers', 'social-paper'), 'href' => trailingslashit(bp_loggedin_user_domain() . $this->slug));
     // Subnav - Published
     $wp_admin_nav[] = array('parent' => 'my-account-' . $this->slug, 'id' => 'my-account-' . $this->slug . '-' . $this->published_slug, 'title' => __('Published', 'social-paper'), 'href' => trailingslashit(bp_loggedin_user_domain() . $this->slug));
     // Subnav - Drafts
     $wp_admin_nav[] = array('parent' => 'my-account-' . $this->slug, 'id' => 'my-account-' . $this->slug . '-' . $this->drafts_slug, 'title' => __('Drafts', 'social-paper'), 'href' => trailingslashit(bp_loggedin_user_domain() . $this->slug . '/' . $this->drafts_slug));
     // Subnav - New Paper
     $wp_admin_nav[] = array('parent' => 'my-account-' . $this->slug, 'id' => 'my-account-' . $this->slug . '-new', 'title' => __('New Paper', 'social-paper'), 'href' => cacsp_get_the_new_paper_link());
     // Add each admin menu
     foreach ($wp_admin_nav as $admin_menu) {
         $GLOBALS['wp_admin_bar']->add_menu($admin_menu);
     }
 }