当前位置: 首页>>代码示例>>PHP>>正文


PHP bbp_get_topic_reply_count函数代码示例

本文整理汇总了PHP中bbp_get_topic_reply_count函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_get_topic_reply_count函数的具体用法?PHP bbp_get_topic_reply_count怎么用?PHP bbp_get_topic_reply_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bbp_get_topic_reply_count函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: widget

        function widget($args, $instance)
        {
            extract($args, EXTR_SKIP);
            $title = !empty($instance['title']) ? $instance['title'] : __('Recent Topics');
            $title = apply_filters('widget_title', $title, $instance, $this->id_base);
            $number = !empty($instance['number']) ? absint($instance['number']) : 5;
            $orderby = !empty($instance['number']) ? strip_tags($instance['order_by']) : 'newness';
            if ($orderby == 'newness') {
                $cb_meta_key = $cb_order_by = NULL;
            } elseif ($orderby == 'popular') {
                $cb_meta_key = '_bbp_reply_count';
                $cb_order_by = 'meta_value';
            } elseif ($orderby == 'freshness') {
                $cb_meta_key = '_bbp_last_active_time';
                $cb_order_by = 'meta_value';
            }
            if (!$number) {
                $number = 5;
            }
            $cb_qry = new WP_Query(array('post_type' => bbp_get_topic_post_type(), 'post_status' => array(bbp_get_public_status_id(), bbp_get_closed_status_id()), 'order' => 'DESC', 'posts_per_page' => $number, 'ignore_sticky_posts' => true, 'no_found_rows' => true, 'meta_key' => $cb_meta_key, 'orderby' => $cb_order_by));
            echo $before_widget;
            echo $before_title . $title . $after_title;
            ?>
            <ul class="cb-bbp-recent-topics">

                <?php 
            while ($cb_qry->have_posts()) {
                $cb_qry->the_post();
                ?>

                    <li>

                        <?php 
                $cb_reply_id = bbp_get_reply_id($cb_qry->post->ID);
                $cb_reply_url = '<a class="bbp-reply-topic-title" href="' . esc_url(bbp_get_reply_url($cb_reply_id)) . '" title="' . esc_attr(bbp_get_reply_excerpt($cb_reply_id, 50)) . '">' . bbp_get_reply_topic_title($cb_reply_id) . '</a>';
                $cb_number_replies = bbp_get_topic_reply_count($cb_reply_id);
                $cb_author_avatar = bbp_get_reply_author_link(array('post_id' => $cb_reply_id, 'type' => 'avatar', 'size' => 60));
                $cb_author_name = bbp_get_reply_author_link(array('post_id' => $cb_reply_id, 'type' => 'name'));
                echo $cb_author_avatar . '<div class="cb-bbp-meta">' . $cb_reply_url . '<div class="cb-bbp-byline">' . __('Started by', 'cubell') . ' ' . $cb_author_name . ' <i class="icon-long-arrow-right"></i> ' . $cb_number_replies . ' replies</div></div>';
                ?>

                    </li>

                <?php 
            }
            ?>

            </ul>

<?php 
            echo $after_widget;
            // Reset the $post global
            wp_reset_postdata();
        }
开发者ID:luskyj89,项目名称:mt-wordpress,代码行数:54,代码来源:cb-bbp-recent-topics.php

示例2: test_bbp_get_topic_reply_count

 /**
  * @covers ::bbp_topic_reply_count
  * @covers ::bbp_get_topic_reply_count
  */
 public function test_bbp_get_topic_reply_count()
 {
     $f = $this->factory->forum->create();
     $t = $this->factory->topic->create(array('post_parent' => $f, 'topic_meta' => array('forum_id' => $f)));
     $int_value = 3;
     $formatted_value = bbp_number_format($int_value);
     $this->factory->reply->create_many($int_value, array('post_parent' => $t, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     bbp_update_topic_reply_count($t);
     // Output
     $this->expectOutputString($formatted_value);
     bbp_topic_reply_count($t);
     // Formatted string
     $count = bbp_get_topic_reply_count($t, false);
     $this->assertSame($formatted_value, $count);
     // Integer
     $count = bbp_get_topic_reply_count($t, true);
     $this->assertSame($int_value, $count);
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:22,代码来源:counts.php

示例3: test_bbp_update_topic_reply_count

 /**
  * @covers ::bbp_update_topic_reply_count
  */
 public function test_bbp_update_topic_reply_count()
 {
     // Create a forum
     $f = $this->factory->forum->create();
     // Create a topic
     $t = $this->factory->topic->create(array('post_parent' => $f, 'topic_meta' => array('forum_id' => $f)));
     // Start with zero
     $count = bbp_get_topic_reply_count($t);
     $this->assertSame('0', $count);
     // Create 3 replies
     $r1 = $this->factory->reply->create_many(3, array('post_parent' => $t, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     $count = bbp_get_topic_reply_count($t);
     $this->assertSame('3', $count);
     bbp_update_topic_reply_count($t);
     $count = bbp_get_topic_reply_count($t);
     $this->assertSame('3', $count);
     // Create another reply
     $r2 = $this->factory->reply->create(array('post_parent' => $t, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     // Test update using reply id
     bbp_update_topic_reply_count($r2);
     $count = bbp_get_topic_reply_count($t);
     $this->assertSame('4', $count);
     // Spam a reply
     bbp_spam_reply($r2);
     bbp_update_topic_reply_count($t);
     $count = bbp_get_topic_reply_count($t);
     $this->assertSame('3', $count);
     // Set the reply count manually
     bbp_update_topic_reply_count($t, 7);
     $count = bbp_get_topic_reply_count($t);
     $this->assertSame('7', $count);
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:35,代码来源:counts.php

示例4: test_bbp_admin_repair_topic_hidden_reply_count

 /**
  * @covers ::bbp_admin_repair_topic_hidden_reply_count
  */
 public function test_bbp_admin_repair_topic_hidden_reply_count()
 {
     $f = $this->factory->forum->create();
     $t = $this->factory->topic->create(array('post_parent' => $f, 'topic_meta' => array('forum_id' => $f)));
     $r = $this->factory->reply->create(array('post_parent' => $t, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     $count = bbp_get_topic_reply_count($t, true);
     $this->assertSame(1, $count);
     $r = $this->factory->reply->create_many(3, array('post_parent' => $t, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     bbp_spam_reply($r[0]);
     bbp_unapprove_reply($r[2]);
     $count = bbp_get_topic_reply_count_hidden($t, true);
     $this->assertSame(2, $count);
     // Delete the topic _bbp_reply_count_hidden meta key.
     $this->assertTrue(delete_post_meta_by_key('_bbp_reply_count_hidden'));
     $count = bbp_get_topic_reply_count_hidden($t, true);
     $this->assertSame(0, $count);
     // Repair the topic hidden reply count meta.
     bbp_admin_repair_topic_hidden_reply_count();
     bbp_clean_post_cache($t);
     $count = bbp_get_topic_reply_count_hidden($t, true);
     $this->assertSame(2, $count);
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:25,代码来源:tools.php

示例5: test_bbp_create_initial_content

 /**
  * @group canonical
  * @covers ::bbp_create_initial_content
  */
 public function test_bbp_create_initial_content()
 {
     $category_id = $this->factory->forum->create(array('forum_meta' => array('_bbp_forum_type' => 'category', '_bbp_status' => 'open')));
     bbp_create_initial_content(array('forum_parent' => $category_id));
     $forum_id = bbp_forum_query_subforum_ids($category_id);
     $forum_id = (int) $forum_id[0];
     $topic_id = bbp_get_forum_last_topic_id($forum_id);
     $reply_id = bbp_get_forum_last_reply_id($forum_id);
     // Forum post
     $this->assertSame('General', bbp_get_forum_title($forum_id));
     $this->assertSame('General chit-chat', bbp_get_forum_content($forum_id));
     $this->assertSame('open', bbp_get_forum_status($forum_id));
     $this->assertTrue(bbp_is_forum_public($forum_id));
     $this->assertSame($category_id, bbp_get_forum_parent_id($forum_id));
     // Topic post
     $this->assertSame($forum_id, bbp_get_topic_forum_id($topic_id));
     $this->assertSame('Hello World!', bbp_get_topic_title($topic_id));
     remove_all_filters('bbp_get_topic_content');
     $topic_content = "I am the first topic in your new forums.";
     $this->assertSame($topic_content, bbp_get_topic_content($topic_id));
     $this->assertSame('publish', bbp_get_topic_status($topic_id));
     $this->assertTrue(bbp_is_topic_published($topic_id));
     // Reply post
     $this->assertSame($forum_id, bbp_get_reply_forum_id($reply_id));
     $this->assertSame('Reply To: Hello World!', bbp_get_reply_title($reply_id));
     $this->assertSame($reply_id, bbp_get_reply_title_fallback($reply_id));
     remove_all_filters('bbp_get_reply_content');
     $reply_content = "Oh, and this is what a reply looks like.";
     $this->assertSame($reply_content, bbp_get_reply_content($reply_id));
     $this->assertSame('publish', bbp_get_reply_status($reply_id));
     $this->assertTrue(bbp_is_reply_published($reply_id));
     // Category meta
     $this->assertSame(1, bbp_get_forum_subforum_count($category_id, true));
     $this->assertSame(0, bbp_get_forum_topic_count($category_id, false, true));
     $this->assertSame(0, bbp_get_forum_topic_count_hidden($category_id, true));
     $this->assertSame(0, bbp_get_forum_reply_count($category_id, false, true));
     $this->assertSame(1, bbp_get_forum_topic_count($category_id, true, true));
     $this->assertSame(1, bbp_get_forum_reply_count($category_id, true, true));
     $this->assertSame(0, bbp_get_forum_post_count($category_id, false, true));
     $this->assertSame(2, bbp_get_forum_post_count($category_id, true, true));
     $this->assertSame($topic_id, bbp_get_forum_last_topic_id($category_id));
     $this->assertSame('Hello World!', bbp_get_forum_last_topic_title($category_id));
     $this->assertSame($reply_id, bbp_get_forum_last_reply_id($category_id));
     $this->assertSame('Reply To: Hello World!', bbp_get_forum_last_reply_title($category_id));
     $this->assertSame($reply_id, bbp_get_forum_last_active_id($category_id));
     $this->assertSame('1 day, 16 hours ago', bbp_get_forum_last_active_time($category_id));
     // Forum meta
     $this->assertSame(0, bbp_get_forum_subforum_count($forum_id, true));
     $this->assertSame(1, bbp_get_forum_topic_count($forum_id, false, true));
     $this->assertSame(0, bbp_get_forum_topic_count_hidden($forum_id, true));
     $this->assertSame(1, bbp_get_forum_reply_count($forum_id, false, true));
     $this->assertSame(1, bbp_get_forum_topic_count($forum_id, true, true));
     $this->assertSame(1, bbp_get_forum_reply_count($forum_id, true, true));
     $this->assertSame(2, bbp_get_forum_post_count($forum_id, false, true));
     $this->assertSame(2, bbp_get_forum_post_count($forum_id, true, true));
     $this->assertSame($topic_id, bbp_get_forum_last_topic_id($forum_id));
     $this->assertSame('Hello World!', bbp_get_forum_last_topic_title($forum_id));
     $this->assertSame($reply_id, bbp_get_forum_last_reply_id($forum_id));
     $this->assertSame('Reply To: Hello World!', bbp_get_forum_last_reply_title($forum_id));
     $this->assertSame($reply_id, bbp_get_forum_last_active_id($forum_id));
     $this->assertSame('1 day, 16 hours ago', bbp_get_forum_last_active_time($forum_id));
     // Topic meta
     $this->assertSame('127.0.0.1', bbp_current_author_ip($topic_id));
     $this->assertSame($forum_id, bbp_get_topic_forum_id($topic_id));
     $this->assertSame(1, bbp_get_topic_voice_count($topic_id, true));
     $this->assertSame(1, bbp_get_topic_reply_count($topic_id, true));
     $this->assertSame(0, bbp_get_topic_reply_count_hidden($topic_id, true));
     $this->assertSame($reply_id, bbp_get_topic_last_reply_id($topic_id));
     $this->assertSame($reply_id, bbp_get_topic_last_active_id($topic_id));
     $this->assertSame('1 day, 16 hours ago', bbp_get_topic_last_active_time($topic_id));
     // Reply Meta
     $this->assertSame('127.0.0.1', bbp_current_author_ip($reply_id));
     $this->assertSame($forum_id, bbp_get_reply_forum_id($reply_id));
     $this->assertSame($topic_id, bbp_get_reply_topic_id($reply_id));
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:79,代码来源:update.php

示例6: test_bbp_unapprove_reply

 /**
  * @covers ::bbp_unapprove_reply
  */
 public function test_bbp_unapprove_reply()
 {
     // Create a forum.
     $f = $this->factory->forum->create();
     // Create a topic.
     $t = $this->factory->topic->create(array('post_parent' => $f, 'topic_meta' => array('forum_id' => $f)));
     // Create some replies.
     $r1 = $this->factory->reply->create(array('post_parent' => $t, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     $reply_post_status = bbp_get_reply_status($r1);
     $this->assertSame('publish', $reply_post_status);
     $topic_reply_count = bbp_get_topic_reply_count($t);
     $this->assertSame('1', $topic_reply_count);
     $r2 = $this->factory->reply->create(array('post_parent' => $t, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     $reply_post_status = bbp_get_reply_status($r2);
     $this->assertSame('publish', $reply_post_status);
     $topic_reply_count = bbp_get_topic_reply_count($t);
     $this->assertSame('2', $topic_reply_count);
     bbp_unapprove_reply($r2);
     $reply_post_status = bbp_get_reply_status($r2);
     $this->assertSame('pending', $reply_post_status);
     $topic_reply_count = bbp_get_topic_reply_count($t);
     $this->assertSame('1', $topic_reply_count);
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:26,代码来源:status.php

示例7: maybe_change_comments_number

 /**
  * If a topic has been used for a post, give the number of replies in place of comment count
  */
 function maybe_change_comments_number($number, $post_ID)
 {
     if (!function_exists('bbp_has_forums')) {
         return $number;
     }
     if (get_post_meta($post_ID, 'use_bbpress_discussion_topic', true)) {
         $topic_ID = get_post_meta($post_ID, 'bbpress_discussion_topic_id', true);
         return bbp_get_topic_reply_count($topic_ID);
     }
     return $number;
 }
开发者ID:benklocek,项目名称:bbPress-Topics-for-Posts,代码行数:14,代码来源:index.php

示例8: bbp_display_topics_feed_rss2


//.........这里部分代码省略.........
</link>
		<description><?php 
    //
    ?>
</description>
		<pubDate><?php 
    echo mysql2date('D, d M Y H:i:s O', current_time('mysql'), false);
    ?>
</pubDate>
		<generator>http://bbpress.org/?v=<?php 
    bbp_version();
    ?>
</generator>
		<language><?php 
    bloginfo_rss('language');
    ?>
</language>

		<?php 
    do_action('bbp_feed_head');
    ?>

		<?php 
    if (bbp_has_topics($topics_query)) {
        ?>

			<?php 
        while (bbp_topics()) {
            bbp_the_topic();
            ?>

				<item>
					<guid><?php 
            bbp_topic_permalink();
            ?>
</guid>
					<title><![CDATA[<?php 
            bbp_topic_title();
            ?>
]]></title>
					<link><?php 
            bbp_topic_permalink();
            ?>
</link>
					<pubDate><?php 
            echo mysql2date('D, d M Y H:i:s +0000', get_post_meta(bbp_get_topic_id(), '_bbp_last_active_time', true));
            ?>
</pubDate>
					<dc:creator><?php 
            the_author();
            ?>
</dc:creator>

					<?php 
            if (!post_password_required()) {
                ?>

					<description>
						<![CDATA[
						<p><?php 
                printf(esc_html__('Replies: %s', 'bbpress'), bbp_get_topic_reply_count());
                ?>
</p>
						<?php 
                bbp_topic_content();
                ?>
						]]>
					</description>

					<?php 
                rss_enclosure();
                ?>

					<?php 
            }
            ?>

					<?php 
            do_action('bbp_feed_item');
            ?>

				</item>

				<?php 
        }
        ?>
			<?php 
    }
    ?>

		<?php 
    do_action('bbp_feed_footer');
    ?>

	</channel>
	</rss>

<?php 
    exit;
}
开发者ID:jenia-buianov,项目名称:all_my_sites,代码行数:101,代码来源:functions.php

示例9: test_bbp_delete_topic_replies

 /**
  * @covers ::bbp_delete_topic_replies
  */
 public function test_bbp_delete_topic_replies()
 {
     $f = $this->factory->forum->create();
     $t = $this->factory->topic->create(array('post_parent' => $f, 'topic_meta' => array('forum_id' => $f)));
     $r = $this->factory->reply->create_many(2, array('post_parent' => $t, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     $this->assertSame(2, bbp_get_topic_reply_count($t, true));
     bbp_delete_topic_replies($t);
     $count = count(bbp_get_all_child_ids($t, bbp_get_reply_post_type()));
     $this->assertSame(0, $count);
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:13,代码来源:topic.php

示例10: post


//.........这里部分代码省略.........
     if (user_can($user_id, 'unfiltered_html')) {
         remove_filter('bbp_new_reply_pre_title', 'wp_filter_kses');
         remove_filter('bbp_new_reply_pre_content', 'wp_filter_kses');
     }
     /** REPLY DATA ***************************************************/
     // setup a dummy reply title b/c bbP requires it
     $reply_title = sprintf(__('Reply To: Topic ID %d', 'bp-rbe'), $topic_id);
     // Filter and sanitize
     $reply_content = apply_filters('bbp_new_reply_pre_content', $data['content']);
     /** REPLY MODERATION *********************************************/
     // Reply Flooding
     if (!bbp_check_for_flood($anonymous_data, $reply_author)) {
         //do_action( 'bp_rbe_imap_no_match', $connection, $i, $headers, 'bbp_reply_flood' );
         //bbp_add_error( 'bbp_reply_flood', __( '<strong>ERROR</strong>: Slow down; you move too fast.', 'bbpress' ) );
         return new WP_Error('bbp_reply_flood', '', $data);
     }
     // Reply Duplicate
     if (!bbp_check_for_duplicate(array('post_type' => bbp_get_reply_post_type(), 'post_author' => $reply_author, 'post_content' => $reply_content, 'post_parent' => $topic_id, 'anonymous_data' => $anonymous_data))) {
         //do_action( 'bp_rbe_imap_no_match', $connection, $i, $headers, 'bbp_reply_duplicate' );
         return new WP_Error('bbp_reply_duplicate', '', $data);
     }
     // Reply Blacklist
     if (!bbp_check_for_blacklist($anonymous_data, $reply_author, $reply_title, $reply_content)) {
         //do_action( 'bp_rbe_imap_no_match', $connection, $i, $headers, 'bbp_reply_blacklist' );
         return new WP_Error('bbp_reply_blacklist', '', $data);
     }
     // Reply Status
     // Maybe put into moderation
     if (!bbp_check_for_moderation($anonymous_data, $reply_author, $reply_title, $reply_content)) {
         $reply_status = bbp_get_pending_status_id();
         // Default
     } else {
         $reply_status = bbp_get_public_status_id();
     }
     /** POSTING TIME! ************************************************/
     // get forum ID
     $forum_id = bbp_get_topic_forum_id($topic_id);
     // bbP hook before save
     do_action('bbp_new_reply_pre_extras', $topic_id, $forum_id);
     // Setup reply data
     $reply_data = apply_filters('bbp_new_reply_pre_insert', array('post_author' => $reply_author, 'post_title' => $reply_title, 'post_content' => $reply_content, 'post_status' => $reply_status, 'post_parent' => $topic_id, 'post_type' => bbp_get_reply_post_type(), 'comment_status' => 'closed', 'menu_order' => bbp_get_topic_reply_count($topic_id, false) + 1));
     // Insert reply
     $reply_id = wp_insert_post($reply_data);
     // Reply posted!
     if (!is_wp_error($reply_id)) {
         // more internal logging
         bp_rbe_log('Message #' . $i . ': bbPress reply successfully posted!');
         // Problem posting
     } else {
         //do_action( 'bp_rbe_imap_no_match', $connection, $i, $headers, 'bbp_reply_error' );
         return new WP_Error('bbp_reply_error', '', $data);
     }
     /** AFTER POSTING ************************************************/
     // stuff that needs to happen after a bbP reply is posted occurs here... bbP
     // should preferably do the following at the 'bbp_new_reply' hook, until then
     // do what bbP does inline.
     // Trash Check ////////////////////////////////////////////////////
     // If this reply starts as trash, add it to pre_trashed_replies
     // for the topic, so it is properly restored.
     if (bbp_is_topic_trash($topic_id) || $reply_data['post_status'] == bbp_get_trash_status_id()) {
         // Trash the reply
         wp_trash_post($reply_id);
         // Only add to pre-trashed array if topic is trashed
         if (bbp_is_topic_trash($topic_id)) {
             // Get pre_trashed_replies for topic
             $pre_trashed_replies = get_post_meta($topic_id, '_bbp_pre_trashed_replies', true);
             // Add this reply to the end of the existing replies
             $pre_trashed_replies[] = $reply_id;
             // Update the pre_trashed_reply post meta
             update_post_meta($topic_id, '_bbp_pre_trashed_replies', $pre_trashed_replies);
         }
         // Spam Check /////////////////////////////////////////////////////
         // If reply or topic are spam, officially spam this reply
     } elseif (bbp_is_topic_spam($topic_id) || $reply_data['post_status'] == bbp_get_spam_status_id()) {
         add_post_meta($reply_id, '_bbp_spam_meta_status', bbp_get_public_status_id());
         // Only add to pre-spammed array if topic is spam
         if (bbp_is_topic_spam($topic_id)) {
             // Get pre_spammed_replies for topic
             $pre_spammed_replies = get_post_meta($topic_id, '_bbp_pre_spammed_replies', true);
             // Add this reply to the end of the existing replies
             $pre_spammed_replies[] = $reply_id;
             // Update the pre_spammed_replies post meta
             update_post_meta($topic_id, '_bbp_pre_spammed_replies', $pre_spammed_replies);
         }
     }
     // Reply By Email /////////////////////////////////////////////////
     // Add a RBE marker to the post's meta
     // Could potentially show that post was made via email on the frontend
     add_post_meta($reply_id, 'bp_rbe', 1);
     /** POST HOOKS ***************************************************/
     // RBE Custom Hooks ///////////////////////////////////////////////
     // change activity action
     add_filter('bbp_before_record_activity_parse_args', array($this, 'change_activity_action'));
     // add RBE's special activity hook
     add_action('bp_activity_after_save', array($this, 'activity_rbe_hook'));
     // bbPress Reply Hooks ////////////////////////////////////////////
     do_action('bbp_new_reply', $reply_id, $topic_id, $forum_id, $anonymous_data, $reply_author, false, $reply_to);
     do_action('bbp_new_reply_post_extras', $reply_id);
     return array('bbp_reply_id' => $reply_id);
 }
开发者ID:r-a-y,项目名称:bp-reply-by-email,代码行数:101,代码来源:bp-rbe-extend-bbpress.php

示例11: wm_bbp_additional_class

 function wm_bbp_additional_class($classes)
 {
     //Helper variables
     $voices_count = bbp_get_topic_voice_count();
     $replies_count = bbp_show_lead_topic() ? bbp_get_topic_reply_count() : bbp_get_topic_post_count();
     if (bbp_get_forum_post_type() == get_post_type()) {
         $voices_count = bbp_get_forum_topic_count();
         $replies_count = bbp_show_lead_topic() ? bbp_get_forum_reply_count() : bbp_get_forum_post_count();
     }
     //Preparing output
     $classes[] = 1 < $voices_count ? 'multi-voices' : 'single-voice';
     $classes[] = 1 < $replies_count ? 'multi-replies' : 'single-reply';
     //Output
     return apply_filters('wmhook_wm_bbp_additional_class_output', $classes);
 }
开发者ID:pab44,项目名称:pab44,代码行数:15,代码来源:setup-bbpress.php

示例12: prepare_items

 /**
  * Prepare the list-table items for display
  *
  * @since 2.6.0 bbPress (r5886)
  *
  * @uses $this->_column_headers
  * @uses $this->items
  * @uses $this->get_columns()
  * @uses $this->get_sortable_columns()
  * @uses $this->get_pagenum()
  * @uses $this->set_pagination_args()
  */
 public function prepare_items($topic_id = 0)
 {
     // Sanitize the topic ID
     $topic_id = bbp_get_topic_id($topic_id);
     // Set column headers
     $this->_column_headers = array($this->get_columns(), array(), $this->get_sortable_columns());
     // Handle bulk actions
     $this->process_bulk_action();
     // Query parameters
     $per_page = 5;
     $current_page = $this->get_pagenum();
     $orderby = !empty($_REQUEST['orderby']) ? $_REQUEST['orderby'] : 'date';
     $order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'asc';
     // Query for replies
     $reply_query = new WP_Query(array('post_type' => bbp_get_reply_post_type(), 'post_parent' => $topic_id, 'posts_per_page' => $per_page, 'paged' => $current_page, 'orderby' => $orderby, 'order' => ucwords($order), 'hierarchical' => false, 'ignore_sticky_posts' => true));
     // Get the total number of replies, for pagination
     $total_items = bbp_get_topic_reply_count($topic_id);
     // Set list table items to queried posts
     $this->items = $reply_query->posts;
     // Set the pagination arguments
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items / $per_page)));
 }
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:34,代码来源:topic-replies.php

示例13: get_comments

 protected function get_comments()
 {
     return bbp_get_topic_reply_count($this->post->ID, true);
 }
开发者ID:konnektiv,项目名称:expert-finder,代码行数:4,代码来源:expertfinder-post-topic-result-class.php

示例14: test_bbp_unspam_topic_replies

 /**
  * @covers ::bbp_unspam_topic_replies
  */
 public function test_bbp_unspam_topic_replies()
 {
     $f = $this->factory->forum->create();
     $now = time();
     $post_date_topic = date('Y-m-d H:i:s', $now - 60 * 60 * 100);
     $post_date_reply = date('Y-m-d H:i:s', $now - 60 * 60 * 80);
     $topic_time = '4 days, 4 hours ago';
     $reply_time = '3 days, 8 hours ago';
     $t = $this->factory->topic->create(array('post_parent' => $f, 'post_date' => $post_date_topic, 'topic_meta' => array('forum_id' => $f)));
     $r = $this->factory->reply->create_many(2, array('post_parent' => $t, 'post_date' => $post_date_reply, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     bbp_spam_topic_replies($t);
     bbp_unspam_topic_replies($t);
     $this->assertEquals('', get_post_meta($t, '_bbp_pre_spammed_replies', true));
     $this->assertEquals(array(), get_post_meta($t, '_bbp_pre_spammed_replies', false));
     foreach ($r as $reply) {
         $reply_status = get_post_status($reply);
         $this->assertSame(bbp_get_public_status_id(), $reply_status);
         $this->assertEquals('', get_post_meta($reply, '_wp_trash_meta_status', true));
         $this->assertEquals(array(), get_post_meta($reply, '_wp_trash_meta_status', false));
     }
     $count = bbp_get_forum_reply_count($f, false, true);
     $this->assertSame(2, $count);
     $last_reply_id = bbp_get_forum_last_reply_id($f);
     $this->assertSame($r[1], $last_reply_id);
     $last_active_id = bbp_get_forum_last_active_id($f);
     $this->assertSame($r[1], $last_active_id);
     $last_active_time = bbp_get_forum_last_active_time($f);
     $this->assertSame($reply_time, $last_active_time);
     $count = bbp_get_topic_reply_count($t, true, true);
     $this->assertSame(2, $count);
     $count = bbp_get_topic_reply_count_hidden($t, true, true);
     $this->assertSame(0, $count);
     $last_reply_id = bbp_get_topic_last_reply_id($t);
     $this->assertSame($r[1], $last_reply_id);
     $last_active_id = bbp_get_topic_last_active_id($t);
     $this->assertSame($r[1], $last_active_id);
     $last_active_time = bbp_get_topic_last_active_time($t);
     $this->assertSame($reply_time, $last_active_time);
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:42,代码来源:status.php

示例15: apoc_topic_byline

function apoc_topic_byline($args = '')
{
    // Default arguments
    $defaults = array('topic_id' => 0, 'before' => '<p class="post-byline">', 'after' => '</p>', 'size' => 50, 'echo' => true);
    $args = wp_parse_args($args, $defaults);
    // Validate topic_id
    $topic_id = bbp_get_topic_id($args['topic_id']);
    // Get the author avatar
    $avatar = apoc_get_avatar(array('user_id' => bbp_get_topic_author_id(), 'size' => $args['size']));
    // Build the topic description
    $voice_count = bbp_get_topic_voice_count($topic_id);
    $reply_count = bbp_get_topic_reply_count($topic_id, true) + 1;
    $time_since = bbp_get_topic_freshness_link($topic_id);
    $author = bbp_get_author_link(array('post_id' => $topic_id, 'type' => 'name'));
    // Singular/Plural
    $reply_count = sprintf(_n('%d posts', '%d posts', $reply_count), $reply_count);
    $voice_count = sprintf(_n('%s member', '%s members', $voice_count), $voice_count);
    // Topic has replies
    $last_reply = bbp_get_topic_last_active_id($topic_id);
    if (!empty($last_reply)) {
        $last_updated_by = bbp_get_author_link(array('post_id' => $last_reply, 'type' => 'name'));
        $retstr = sprintf('This topic by %1$s contains %2$s by %3$s, and was last updated by %4$s, %5$s.', $author, $reply_count, $voice_count, $last_updated_by, $time_since);
        // Topic has no replies
    } elseif (!empty($voice_count) && !empty($reply_count)) {
        $retstr = sprintf('This topic contains %1$s by %2$s.', $reply_count, $voice_count);
        // Topic has no replies and no voices
    } elseif (empty($voice_count) && empty($reply_count)) {
        $retstr = sprintf('This topic has no replies yet.');
    }
    // Combine the elements together
    $retstr = $args['before'] . $avatar . '<span>' . $retstr . '</span>' . $args['after'];
    // Return filtered result
    if (true == $args['echo']) {
        echo $retstr;
    } else {
        return $retstr;
    }
}
开发者ID:tamriel-foundry,项目名称:apoc2,代码行数:38,代码来源:bbpress.php


注:本文中的bbp_get_topic_reply_count函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。