function setup_admin_bar($wp_admin_nav = array())
 {
     global $bp;
     $directWorkflow = isDirectWorkflow();
     if (is_user_logged_in()) {
         if ($directWorkflow) {
             $postCount = custom_get_user_posts_count(array("publish", "draft"));
         } else {
             $postCount = custom_get_user_posts_count(array("publish", "pending", "draft"));
         }
         $user_domain = bp_loggedin_user_domain();
         $wp_admin_nav[] = array('parent' => 'my-account-buddypress', 'id' => 'my-account-social-articles', 'title' => __('Social Articles', 'social-articles'), 'href' => trailingslashit($user_domain . 'articles'));
         $wp_admin_nav[] = array('parent' => 'my-account-social-articles', 'title' => sprintf(__('My Articles <span class="count">%d</span>', 'social-articles'), $postCount), 'href' => trailingslashit($user_domain . 'articles'));
         $wp_admin_nav[] = array('parent' => 'my-account-social-articles', 'title' => sprintf(__('New Article', 'social-articles')), 'href' => trailingslashit($user_domain . 'articles/new'));
     }
     if ($this->check_visibility()) {
         parent::setup_admin_bar($wp_admin_nav);
     }
 }
Exemplo n.º 2
0
<?php

global $post, $wpdb, $bp, $socialArticles;
$directWorkflow = isDirectWorkflow();
$statusLabels = array("publish" => __('Published', 'social-articles'), "draft" => __('Draft', 'social-articles'), "pending" => __('Under review', 'social-articles'), "new-post" => __('New', 'social-articles'));
if (isset($_GET['article'])) {
    $myArticle = get_post($_GET['article']);
    $post_id = $_GET['article'];
    if (isset($myArticle) && $myArticle->post_author == bp_loggedin_user_id() && ($socialArticles->options['allow_author_adition'] == "true" || $myArticle->post_status == "draft")) {
        $state = "ok";
        $title = $myArticle->post_title;
        $content = $myArticle->post_content;
        $status = $myArticle->post_status;
        $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($_GET['article']), 'large');
        if (isset($large_image_url)) {
            $image_name = end(explode("/", $large_image_url[0]));
        }
        ?>
           
            <input type="hidden" id="mode" value="edit"/>
            <input type="hidden" id="feature-image-url" value="<?php 
        echo $large_image_url[0];
        ?>
"/>    
           <?php 
    } else {
        $state = "error";
        $message = __("You cannot perform this action", "social-articles");
    }
    ?>