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


PHP bbp_get_forum_topic_count函数代码示例

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


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

示例1: test_bbp_insert_forum

 /**
  * @group canonical
  * @covers ::bbp_insert_forum
  */
 public function test_bbp_insert_forum()
 {
     $f = $this->factory->forum->create(array('post_title' => 'Forum 1', 'post_content' => 'Content of Forum 1'));
     $now = time();
     $post_date = date('Y-m-d H:i:s', $now - 60 * 60 * 100);
     $t = $this->factory->topic->create(array('post_parent' => $f, 'post_date' => $post_date, 'topic_meta' => array('forum_id' => $f)));
     $r = $this->factory->reply->create(array('post_parent' => $t, 'post_date' => $post_date, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     // Get the forum.
     $forum = bbp_get_forum($f);
     // Forum post.
     $this->assertSame('Forum 1', bbp_get_forum_title($f));
     $this->assertSame('Content of Forum 1', bbp_get_forum_content($f));
     $this->assertSame('open', bbp_get_forum_status($f));
     $this->assertSame('forum', bbp_get_forum_type($f));
     $this->assertTrue(bbp_is_forum_public($f));
     $this->assertSame(0, bbp_get_forum_parent_id($f));
     $this->assertEquals('http://' . WP_TESTS_DOMAIN . '/?forum=' . $forum->post_name, $forum->guid);
     // Forum meta.
     $this->assertSame(0, bbp_get_forum_subforum_count($f, true));
     $this->assertSame(1, bbp_get_forum_topic_count($f, false, true));
     $this->assertSame(1, bbp_get_forum_topic_count($f, true, true));
     $this->assertSame(0, bbp_get_forum_topic_count_hidden($f, true));
     $this->assertSame(1, bbp_get_forum_reply_count($f, false, true));
     $this->assertSame(1, bbp_get_forum_reply_count($f, true, true));
     $this->assertSame(2, bbp_get_forum_post_count($f, false, true));
     $this->assertSame(2, bbp_get_forum_post_count($f, true, true));
     $this->assertSame($t, bbp_get_forum_last_topic_id($f));
     $this->assertSame($r, bbp_get_forum_last_reply_id($f));
     $this->assertSame($r, bbp_get_forum_last_active_id($f));
     $this->assertSame('4 days, 4 hours ago', bbp_get_forum_last_active_time($f));
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:35,代码来源:forum.php

示例2: test_bbp_get_forum_topic_count

 /**
  * @covers ::bbp_forum_topic_count
  * @covers ::bbp_get_forum_topic_count
  */
 public function test_bbp_get_forum_topic_count()
 {
     $c = $this->factory->forum->create(array('forum_meta' => array('forum_type' => 'category')));
     $f = $this->factory->forum->create(array('post_parent' => $c, 'forum_meta' => array('forum_id' => $c)));
     $int_value = 3;
     $formatted_value = bbp_number_format($int_value);
     $this->factory->topic->create_many($int_value, array('post_parent' => $f));
     bbp_update_forum_topic_count($c);
     bbp_update_forum_topic_count($f);
     // Forum output.
     $count = bbp_get_forum_topic_count($f, true, false);
     $this->expectOutputString($formatted_value);
     bbp_forum_topic_count($f);
     // Forum formatted string.
     $count = bbp_get_forum_topic_count($f, true, false);
     $this->assertSame($formatted_value, $count);
     // Forum integer.
     $count = bbp_get_forum_topic_count($f, true, true);
     $this->assertSame($int_value, $count);
     // Category topic count.
     $count = bbp_get_forum_topic_count($c, false, true);
     $this->assertSame(0, $count);
     // Category total topic count.
     $count = bbp_get_forum_topic_count($c, true, true);
     $this->assertSame($int_value, $count);
 }
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:30,代码来源:counts.php

示例3: test_bbp_get_forum_topic_count

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

示例4: apoc_loop_subforums

/**
 * Display nested subforums with a hierarchical structure using their parent category
 * @version 2.0
 */
function apoc_loop_subforums()
{
    // Exclude private forums
    $private = apoc_private_forum_ids();
    // Check for subforums
    $subs = bbp_forum_get_subforums(array('post__not_in' => $private));
    if (empty($subs)) {
        return;
    }
    // Buffer output
    ob_start();
    // Print a header
    ?>
	<header class="forum-header">
		<div class="forum-content"><h2><?php 
    bbp_forum_title();
    ?>
</h2></div>
		<div class="forum-count">Topics</div>
		<div class="forum-freshness">Latest Post</div>
	</header>
	<ol class="forums category <?php 
    bbp_forum_status();
    ?>
"><?php 
    // Loop over forums
    foreach ($subs as $count => $sub) {
        // Get forum details
        $sub_id = $sub->ID;
        $title = $sub->post_title;
        $desc = $sub->post_content;
        $permalink = bbp_get_forum_permalink($sub_id);
        // Get topic counts
        $topics = bbp_get_forum_topic_count($sub_id, false);
        // Get the most recent reply and its topic
        $reply_id = bbp_get_forum_last_reply_id($sub_id);
        $topic_id = bbp_is_reply($reply_id) ? bbp_get_reply_topic_id($reply_id) : $reply_id;
        $topic_title = bbp_get_topic_title($topic_id);
        $link = bbp_get_reply_url($reply_id);
        // Get the author avatar
        $user_id = bbp_get_reply_author_id($reply_id);
        $avatar = apoc_get_avatar(array('user_id' => $user_id, 'link' => true, 'size' => 50));
        // Toggle html class
        $class = $count % 2 ? 'odd' : 'even';
        // Print output
        ?>
		<li id="forum-<?php 
        echo $sub_id;
        ?>
" class="forum <?php 
        echo $class;
        ?>
">
			<div class="forum-content">
				<h3 class="forum-title"><a href="<?php 
        echo $permalink;
        ?>
" title="Browse <?php 
        echo $title;
        ?>
"><?php 
        echo $title;
        ?>
</a></h3>
				<p class="forum-description"><?php 
        echo $desc;
        ?>
</p>
			</div>

			<div class="forum-count">
				<?php 
        echo $topics;
        ?>
			</div>

			<div class="forum-freshness">
				<?php 
        echo $avatar;
        ?>
				<div class="freshest-meta">
					<a class="freshest-title" href="<?php 
        echo $link;
        ?>
" title="<?php 
        echo $topic_title;
        ?>
"><?php 
        echo $topic_title;
        ?>
</a>
					<span class="freshest-author">By <?php 
        bbp_author_link(array('post_id' => $reply_id, 'type' => 'name'));
        ?>
</span>
					<span class="freshest-time"><?php 
//.........这里部分代码省略.........
开发者ID:tamriel-foundry,项目名称:apoc2,代码行数:101,代码来源:bbpress.php

示例5: td_show_forum

function td_show_forum($forum_object)
{
    $last_active = bbp_get_forum_last_active_id($forum_object->ID);
    $time_since = '';
    $last_updated_by_avatar = '';
    if (!empty($last_active)) {
        $time_since = bbp_get_forum_freshness_link($forum_object->ID);
        $last_updated_by_avatar = bbp_get_author_link(array('post_id' => $last_active, 'size' => 40, 'type' => 'avatar'));
        //echo $time_since;
    }
    ?>
    <div class="clearfix"></div>
    <ul class="td-forum-list-table td-forum-content">
        <li class="td-forum-category-title<?php 
    if (empty($forum_object->post_content)) {
        echo ' td-forum-title-no-desc';
    }
    ?>
">
            <div class="td-forum-index-padd">
                <a class="bbp-forum-title" href="<?php 
    bbp_forum_permalink($forum_object->ID);
    ?>
"><?php 
    bbp_forum_title($forum_object->ID);
    ?>
</a>
                <?php 
    if (!empty($forum_object->post_content)) {
        ?>
                    <div class="td-forum-description"><?php 
        echo $forum_object->post_content;
        ?>
</div>
                <?php 
    }
    ?>

                </li><li class="td-forum-replies">
                    <div><?php 
    echo bbp_get_forum_topic_count($forum_object->ID);
    ?>
 topics</div>
                    <div><?php 
    echo bbp_get_forum_reply_count($forum_object->ID);
    ?>
 replies</div>
                </li><li class="td-forum-last-comment">

                <div>
                    <?php 
    echo $last_updated_by_avatar;
    ?>
                </div>



                <div class="td-forum-last-comment-content">
                    <div class="td-forum-author-name">
                        by <a class="td-forum-last-author" href="<?php 
    bbp_reply_author_url($last_active);
    ?>
"><?php 
    echo bbp_get_topic_author_display_name($last_active);
    ?>
</a>
                    </div>
                    <div class="td-forum-time-comment">
                        <?php 
    bbp_forum_freshness_link($forum_object->ID);
    ?>
                    </div>
                </div>
        </li>
    </ul>
    <div class="clearfix"></div>
    <?php 
}
开发者ID:Vatia13,项目名称:wordpress,代码行数:78,代码来源:content-archive-forum.php

示例6: bbp_get_forum_permalink

            <span class="padding-left-20"><a class="bbp-forum-title" href="<?php 
                echo bbp_get_forum_permalink($sub_forum->ID);
                ?>
">
              <?php 
                echo get_the_post_thumbnail($sub_forum->ID, array(70, 70));
                ?>
              <span><?php 
                echo bbp_get_forum_title($sub_forum->ID);
                ?>
</span>
            </a></span>
          </li>

          <li class="bbp-forum-topic-count"><?php 
                echo bbp_get_forum_topic_count($sub_forum->ID);
                ?>
</li>
          <li class="bbp-forum-reply-count"><?php 
                echo bbp_get_forum_reply_count($sub_forum->ID);
                ?>
</li>
          <li class="bbp-forum-freshness">

            <div class="author-avatar">
              <?php 
                $last_reply_avatar = bbp_get_reply_author_avatar(bbp_get_forum_last_reply_id($sub_forum->ID), 50);
                if ($last_reply_avatar != '') {
                    echo $last_reply_avatar;
                } else {
                    echo bbp_get_topic_author_avatar($sub_forum->ID, 50);
开发者ID:hakkens,项目名称:davehakkens,代码行数:31,代码来源:loop-forums.php

示例7: test_bbp_move_topic_handler

 /**
  * @covers ::bbp_move_topic_handler
  */
 public function test_bbp_move_topic_handler()
 {
     $old_current_user = 0;
     $this->old_current_user = get_current_user_id();
     $this->set_current_user($this->factory->user->create(array('role' => 'administrator')));
     $this->keymaster_id = get_current_user_id();
     bbp_set_user_role($this->keymaster_id, bbp_get_keymaster_role());
     $old_forum_id = $this->factory->forum->create();
     $topic_id = $this->factory->topic->create(array('post_parent' => $old_forum_id, 'topic_meta' => array('forum_id' => $old_forum_id)));
     $reply_id = $this->factory->reply->create(array('post_parent' => $topic_id, 'reply_meta' => array('forum_id' => $old_forum_id, 'topic_id' => $topic_id)));
     // Topic post parent
     $topic_parent = wp_get_post_parent_id($topic_id);
     $this->assertSame($old_forum_id, $topic_parent);
     // Forum meta
     $this->assertSame(1, bbp_get_forum_topic_count($old_forum_id, true, true));
     $this->assertSame(1, bbp_get_forum_reply_count($old_forum_id, true, true));
     $this->assertSame($topic_id, bbp_get_forum_last_topic_id($old_forum_id));
     $this->assertSame($reply_id, bbp_get_forum_last_reply_id($old_forum_id));
     $this->assertSame($reply_id, bbp_get_forum_last_active_id($old_forum_id));
     // Topic meta
     $this->assertSame($old_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($reply_id, bbp_get_topic_last_reply_id($topic_id));
     $this->assertSame($reply_id, bbp_get_topic_last_active_id($topic_id));
     // Reply Meta
     $this->assertSame($old_forum_id, bbp_get_reply_forum_id($reply_id));
     $this->assertSame($topic_id, bbp_get_reply_topic_id($reply_id));
     // Create a new forum
     $new_forum_id = $this->factory->forum->create();
     // Move the topic into the new forum
     bbp_move_topic_handler($topic_id, $old_forum_id, $new_forum_id);
     // Topic post parent
     $topic_parent = wp_get_post_parent_id($topic_id);
     $this->assertSame($new_forum_id, $topic_parent);
     // Forum meta
     $this->assertSame(1, bbp_get_forum_topic_count($new_forum_id, true, true));
     $this->assertSame(1, bbp_get_forum_reply_count($new_forum_id, true, true));
     $this->assertSame($topic_id, bbp_get_forum_last_topic_id($new_forum_id));
     $this->assertSame($reply_id, bbp_get_forum_last_reply_id($new_forum_id));
     $this->assertSame($reply_id, bbp_get_forum_last_active_id($new_forum_id));
     // Topic meta
     $this->assertSame($new_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($reply_id, bbp_get_topic_last_reply_id($topic_id));
     $this->assertSame($reply_id, bbp_get_topic_last_active_id($topic_id));
     // Reply Meta
     $this->assertSame($new_forum_id, bbp_get_reply_forum_id($reply_id));
     $this->assertSame($topic_id, bbp_get_reply_topic_id($reply_id));
     // Retore the user
     $this->set_current_user($this->old_current_user);
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:56,代码来源:topic.php

示例8: test_bbp_unspam_topic

 /**
  * @covers ::bbp_unspam_topic
  */
 public function test_bbp_unspam_topic()
 {
     $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($t);
     bbp_unspam_topic($t);
     $topic_status = get_post_status($t);
     $this->assertSame(bbp_get_public_status_id(), $topic_status);
     $this->assertEquals('', get_post_meta($t, '_bbp_pre_spammed_replies', true));
     $this->assertEquals(array(), get_post_meta($t, '_bbp_pre_spammed_replies', false));
     $this->assertEquals('', get_post_meta($t, '_bbp_spam_meta_status', true));
     $this->assertEquals(array(), get_post_meta($t, '_bbp_spam_meta_status', false));
     $count = bbp_get_forum_topic_count($f, false, true);
     $this->assertSame(1, $count);
     $count = bbp_get_forum_topic_count_hidden($f, true);
     $this->assertSame(0, $count);
     $count = bbp_get_forum_reply_count($f, false, true);
     $this->assertSame(2, $count);
     $last_topic_id = bbp_get_forum_last_topic_id($f);
     $this->assertSame($t, $last_topic_id);
     $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,代码行数:46,代码来源:status.php

示例9: custom_list_forums

function custom_list_forums($args = '')
{
    // Define used variables
    global $rpg_settingsg;
    global $rpg_settingsf;
    $output = $sub_forums = $topic_count = $reply_count = $counts = '';
    $i = 0;
    $count = array();
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('before' => '<ul class="bbp-forums-list">', 'after' => '</ul>', 'link_before' => '<li class="bbp-forum">', 'link_after' => '</li>', 'count_before' => ' (', 'count_after' => ')', 'count_sep' => ', ', 'separator' => '<br> ', 'forum_id' => '', 'show_topic_count' => true, 'show_reply_count' => true), 'listb_forums');
    // Loop through forums and create a list
    $sub_forums = bbp_forum_get_subforums($r['forum_id']);
    if (!empty($sub_forums)) {
        // Total count (for separator)
        $total_subs = count($sub_forums);
        foreach ($sub_forums as $sub_forum) {
            $i++;
            // Separator count
            // Get forum details
            $count = array();
            $show_sep = $total_subs > $i ? $r['separator'] : '';
            $permalink = bbp_get_forum_permalink($sub_forum->ID);
            $title = bbp_get_forum_title($sub_forum->ID);
            $content = bbp_get_forum_content($sub_forum->ID);
            if ($rpg_settingsg['activate_descriptions'] == true) {
                $content = bbp_get_forum_content($sub_forum->ID);
            } else {
                $content = '';
            }
            // Show topic count
            if (!empty($r['show_topic_count']) && !bbp_is_forum_category($sub_forum->ID)) {
                $count['topic'] = bbp_get_forum_topic_count($sub_forum->ID);
            }
            // Show reply count
            if (!empty($r['show_reply_count']) && !bbp_is_forum_category($sub_forum->ID)) {
                $count['reply'] = bbp_get_forum_reply_count($sub_forum->ID);
            }
            // Counts to show
            if (!empty($count)) {
                $counts = $r['count_before'] . implode($r['count_sep'], $count) . $r['count_after'];
            }
            if ($rpg_settingsg['hide_counts'] == true) {
                $counts = '';
            }
            //Build this sub forums link
            if (bbp_is_forum_private($sub_forum->ID)) {
                if (!current_user_can('read_private_forums')) {
                    if (!$rpg_settingsf['redirect_page']) {
                        $link = '/home';
                    } else {
                        $link = $rpg_settingsf['redirect_page'];
                    }
                    $output .= $r['before'] . $r['link_before'] . '<a href="' . $link . '" class="bbp-forum-link">' . $title . $counts . '</a>' . $show_sep . $r['link_after'] . '<div class="bbp-forum-content">' . $content . '</div>' . $r['after'];
                } else {
                    $output .= $r['before'] . $r['link_before'] . '<a href="' . esc_url($permalink) . '" class="bbp-forum-link">' . $title . $counts . '</a>' . $show_sep . $r['link_after'] . '<div class="bbp-forum-content">' . $content . '</div>' . $r['after'];
                }
            } else {
                $output .= $r['before'] . $r['link_before'] . '<a href="' . esc_url($permalink) . '" class="bbp-forum-link">' . $title . $counts . '</a>' . $show_sep . $r['link_after'] . '<div class="bbp-forum-content">' . $content . '</div>' . $r['after'];
            }
        }
        //Output the list
        return $output;
    }
}
开发者ID:USSLomaPrieta,项目名称:usslomaprieta.org,代码行数:64,代码来源:forum-filters.php

示例10: bbp_forum_id

    <?php 
        if (isset($_REQUEST['orderby']) && $_REQUEST['orderby'] && $_REQUEST['orderby'] == 'most_votes') {
            echo 'class="order-active"';
        }
        ?>
    >Most Votes</a>
  <?php 
    }
}
?>
<div id="bbp-forum-<?php 
bbp_forum_id();
?>
" class="bbp-topics">
<?php 
if (bbp_get_forum_topic_count() > 0) {
    $bbp_loop_args = array('meta_key' => '_bbp_last_active_time', 'orderby' => 'meta_value', 'order' => 'DESC');
    if (isset($_REQUEST['order']) && $_REQUEST['order']) {
        if ($_REQUEST['order'] == 'ASC') {
            $bbp_loop_args['order'] = 'ASC';
        } else {
            $bbp_loop_args['order'] = 'DESC';
        }
    }
    if (isset($_REQUEST['orderby']) && $_REQUEST['orderby']) {
        if ($_REQUEST['orderby'] == 'most_replies') {
            $bbp_loop_args['meta_key'] = '_bbp_reply_count';
            $bbp_loop_args['orderby'] = 'meta_value_num';
        }
    }
    if (isset($_REQUEST['orderby']) && $_REQUEST['orderby']) {
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:31,代码来源:loop-topics.php

示例11: bbp_forum_title

" title="<?php 
    bbp_forum_title();
    ?>
"><?php 
    bbp_forum_title();
    ?>
</a>
			<?php 
    the_content();
    ?>
		</div>

		<div class="bbp-forum-topic-count">

			<i class="fa fa-list-ul"></i><?php 
    echo bbp_get_forum_topic_count(bbp_get_forum_id());
    ?>
<br />
			<i class="fa fa-comments-o"></i><?php 
    echo bbp_get_forum_reply_count(bbp_get_forum_id());
    ?>
		</div>

	<?php 
}
?>

		<?php 
do_action('bbp_theme_before_forum_sub_forums');
nice_bbp_list_forums(array('before' => '<ul class="bbp-forums-list">', 'after' => '</ul>', 'link_before' => '<li class="bbp-forum">', 'link_after' => '</li>', 'count_before' => '<div class="topic-reply-counts"><i class="fa fa-list-ul"></i>', 'count_after' => '</div>', 'count_sep' => '<br /><i class="fa fa-comments-o"></i>', 'separator' => '<div style="clear:both;"></div>', 'forum_id' => '', 'show_topic_count' => true, 'show_reply_count' => true, 'show_freshness_link' => false));
do_action('bbp_theme_after_forum_sub_forums');
开发者ID:supahseppe,项目名称:path-of-gaming,代码行数:31,代码来源:loop-single-forum.php

示例12: buddyboss_bbp_get_single_forum_description

/**
 * Return a fancy description of the current forum, including total
 * topics, total replies, and last activity.
 *
 * @since Boss 1.0.0
 *
 * @param mixed $args This function supports these arguments:
 *  - forum_id: Forum id
 *  - before: Before the text
 *  - after: After the text
 *  - size: Size of the avatar
 * @uses bbp_get_forum_id() To get the forum id
 * @uses bbp_get_forum_topic_count() To get the forum topic count
 * @uses bbp_get_forum_reply_count() To get the forum reply count
 * @uses bbp_get_forum_freshness_link() To get the forum freshness link
 * @uses bbp_get_forum_last_active_id() To get the forum last active id
 * @uses bbp_get_author_link() To get the author link
 * @uses add_filter() To add the 'view all' filter back
 * @uses apply_filters() Calls 'bbp_get_single_forum_description' with
 *                        the description and args
 * @return string Filtered forum description
 */
function buddyboss_bbp_get_single_forum_description($args = '')
{
    // Parse arguments against default values
    $r = bbp_parse_args($args, array('forum_id' => 0, 'before' => '<div class="bbp-template-notice info"><p class="bbp-forum-description">', 'after' => '</p></div>', 'size' => 14, 'feed' => true), 'get_single_forum_description');
    // Validate forum_id
    $forum_id = bbp_get_forum_id($r['forum_id']);
    // Unhook the 'view all' query var adder
    remove_filter('bbp_get_forum_permalink', 'bbp_add_view_all');
    // Get some forum data
    $tc_int = bbp_get_forum_topic_count($forum_id, false);
    $rc_int = bbp_get_forum_reply_count($forum_id, false);
    $topic_count = bbp_get_forum_topic_count($forum_id);
    $reply_count = bbp_get_forum_reply_count($forum_id);
    $last_active = bbp_get_forum_last_active_id($forum_id);
    // Has replies
    if (!empty($reply_count)) {
        $reply_text = sprintf(_n('%s reply', '%s replies', $rc_int, 'boss'), $reply_count);
    }
    // Forum has active data
    if (!empty($last_active)) {
        $topic_text = bbp_get_forum_topics_link($forum_id);
        $time_since = bbp_get_forum_freshness_link($forum_id);
        $last_updated_by = bbp_get_author_link(array('post_id' => $last_active, 'size' => $r['size']));
        // Forum has no last active data
    } else {
        $topic_text = sprintf(_n('%s topic', '%s topics', $tc_int, 'boss'), $topic_count);
    }
    // Forum has active data
    if (!empty($last_active)) {
        if (!empty($reply_count)) {
            if (bbp_is_forum_category($forum_id)) {
                $retstr = sprintf(__('<span class="post-num">%1$s and %2$s</span> <span class="last-activity">Last updated by %3$s %4$s</span>', 'boss'), $topic_text, $reply_text, $last_updated_by, $time_since);
            } else {
                $retstr = sprintf(__('<span class="post-num">%1$s and %2$s</span> <span class="last-activity">Last updated by %3$s %4$s<span>', 'boss'), $topic_text, $reply_text, $last_updated_by, $time_since);
            }
        } else {
            if (bbp_is_forum_category($forum_id)) {
                $retstr = sprintf(__('<span class="post-num">%1$s</span> <span class="last-activity">Last updated by %2$s %3$s</span>', 'boss'), $topic_text, $last_updated_by, $time_since);
            } else {
                $retstr = sprintf(__('<span class="post-num">%1$s</span> <span class="last-activity">Last updated by %2$s %3$s</span>', 'boss'), $topic_text, $last_updated_by, $time_since);
            }
        }
        // Forum has no last active data
    } else {
        if (!empty($reply_count)) {
            if (bbp_is_forum_category($forum_id)) {
                $retstr = sprintf(__('<span class="post-num">%1$s and %2$s</span>', 'boss'), $topic_text, $reply_text);
            } else {
                $retstr = sprintf(__('<span class="post-num">%1$s and %2$s</span>', 'boss'), $topic_text, $reply_text);
            }
        } else {
            if (!empty($topic_count)) {
                if (bbp_is_forum_category($forum_id)) {
                    $retstr = sprintf(__('<span class="post-num">%1$s</span>', 'boss'), $topic_text);
                } else {
                    $retstr = sprintf(__('<span class="post-num">%1$s</span>', 'boss'), $topic_text);
                }
            } else {
                $retstr = __('<span class="post-num">0 topics and 0 posts</span>', 'boss');
            }
        }
    }
    // Add feeds
    //$feed_links = ( !empty( $r['feed'] ) ) ? bbp_get_forum_topics_feed_link ( $forum_id ) . bbp_get_forum_replies_feed_link( $forum_id ) : '';
    // Add the 'view all' filter back
    add_filter('bbp_get_forum_permalink', 'bbp_add_view_all');
    // Combine the elements together
    $retstr = $r['before'] . $retstr . $r['after'];
    // Return filtered result
    return apply_filters('bbp_get_single_forum_description', $retstr, $r);
}
开发者ID:tvolmari,项目名称:hammydowns,代码行数:93,代码来源:theme-functions.php

示例13: do_action

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

		<p class="bbp-topic-meta">

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

			<span class="bbp-topic-freshness-author"><?php 
bbp_author_link(array('post_id' => bbp_get_topic_last_active_id(), 'size' => 40));
?>
            <?php 
$count_tp = bbp_get_forum_topic_count();
$class_tp = '';
if ($count_tp != 0) {
    $class_tp = 'date-post';
}
?>
            <div class="<?php 
echo $class_tp;
?>
"><?php 
bbp_topic_freshness_link();
?>
</div>
            </span>

			<?php 
开发者ID:hamednourhani,项目名称:naiau.ir,代码行数:30,代码来源:loop-single-topic.php

示例14: test_bbp_update_forum_topic_count_hidden

 /**
  * @covers ::bbp_update_forum_topic_count_hidden
  */
 public function test_bbp_update_forum_topic_count_hidden()
 {
     $f = $this->factory->forum->create();
     $count = bbp_get_forum_topic_count($f, false, true);
     $this->assertSame(0, $count);
     $t = $this->factory->topic->create_many(3, array('post_parent' => $f, 'topic_meta' => array('forum_id' => $f)));
     bbp_update_forum_topic_count_hidden($f);
     $count = bbp_get_forum_topic_count_hidden($f, true);
     $this->assertSame(0, $count);
     bbp_spam_topic($t[2]);
     bbp_update_forum_topic_count_hidden($f);
     $count = bbp_get_forum_topic_count_hidden($f, true);
     $this->assertSame(1, $count);
     bbp_unapprove_topic($t[0]);
     bbp_update_forum_topic_count_hidden($f);
     $count = bbp_get_forum_topic_count_hidden($f, true);
     $this->assertSame(2, $count);
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:21,代码来源:counts.php

示例15: test_bbp_admin_repair_forum_topic_count

 /**
  * @covers ::bbp_admin_repair_forum_topic_count
  */
 public function test_bbp_admin_repair_forum_topic_count()
 {
     $c = $this->factory->forum->create(array('forum_meta' => array('forum_type' => 'category', 'status' => 'open')));
     $f = $this->factory->forum->create(array('post_parent' => $c, 'forum_meta' => array('forum_id' => $c, 'forum_type' => 'forum', 'status' => 'open')));
     $t = $this->factory->topic->create(array('post_parent' => $f, 'topic_meta' => array('forum_id' => $f)));
     $count = bbp_get_forum_topic_count($f, true, true);
     $this->assertSame(1, $count);
     $t = $this->factory->topic->create_many(3, array('post_parent' => $f, 'topic_meta' => array('forum_id' => $f)));
     bbp_update_forum_topic_count($c);
     bbp_update_forum_topic_count($f);
     // Category topic count.
     $count = bbp_get_forum_topic_count($c, false, true);
     $this->assertSame(0, $count);
     // Category total topic count.
     $count = bbp_get_forum_topic_count($c, true, true);
     $this->assertSame(4, $count);
     // Category topic count hidden.
     $count = bbp_get_forum_topic_count_hidden($c, true);
     $this->assertSame(0, $count);
     // Forum topic count.
     $count = bbp_get_forum_topic_count($f, false, true);
     $this->assertSame(4, $count);
     // Forum total topic count.
     $count = bbp_get_forum_topic_count($f, true, true);
     $this->assertSame(4, $count);
     // Forum topic count hidden.
     $count = bbp_get_forum_topic_count_hidden($f, true);
     $this->assertSame(0, $count);
     bbp_spam_topic($t[0]);
     bbp_unapprove_topic($t[2]);
     // Category topic count.
     $count = bbp_get_forum_topic_count($c, false, true);
     $this->assertSame(0, $count);
     // Category total topic count.
     $count = bbp_get_forum_topic_count($c, true, true);
     $this->assertSame(2, $count);
     // Category topic count hidden.
     $count = bbp_get_forum_topic_count_hidden($c, true);
     $this->assertSame(0, $count);
     // Forum topic count.
     $count = bbp_get_forum_topic_count($f, false, true);
     $this->assertSame(2, $count);
     // Forum total topic count.
     $count = bbp_get_forum_topic_count($f, true, true);
     $this->assertSame(2, $count);
     // Forum topic count hidden.
     $count = bbp_get_forum_topic_count_hidden($f, true);
     $this->assertSame(2, $count);
     // Delete the _bbp_total_topic_count meta key.
     $this->assertTrue(delete_post_meta_by_key('_bbp_topic_count_hidden'));
     // Delete the _bbp_total_topic_count meta key.
     $this->assertTrue(delete_post_meta_by_key('_bbp_total_topic_count'));
     // Delete the  _bbp_topic_count meta key.
     $this->assertTrue(delete_post_meta_by_key('_bbp_topic_count'));
     // Category topic count.
     $count = bbp_get_forum_topic_count($c, false, true);
     $this->assertSame(0, $count);
     // Category total topic count.
     $count = bbp_get_forum_topic_count($c, true, true);
     $this->assertSame(0, $count);
     // Category topic count hidden.
     $count = bbp_get_forum_topic_count_hidden($c, true);
     $this->assertSame(0, $count);
     // Forum topic count.
     $count = bbp_get_forum_topic_count($f, false, true);
     $this->assertSame(0, $count);
     // Forum total topic count.
     $count = bbp_get_forum_topic_count($f, true, true);
     $this->assertSame(0, $count);
     // Forum topic count hidden.
     $count = bbp_get_forum_topic_count_hidden($f, true);
     $this->assertSame(0, $count);
     // Repair the forum topic count meta.
     bbp_admin_repair_forum_topic_count();
     // Category topic count.
     $count = bbp_get_forum_topic_count($c, false, true);
     $this->assertSame(0, $count);
     // Category total topic count.
     $count = bbp_get_forum_topic_count($c, true, true);
     $this->assertSame(2, $count);
     // Category topic count hidden.
     $count = bbp_get_forum_topic_count_hidden($c, true);
     $this->assertSame(0, $count);
     // Forum topic count.
     $count = bbp_get_forum_topic_count($f, false, true);
     $this->assertSame(2, $count);
     // Forum total topic count.
     $count = bbp_get_forum_topic_count($f, true, true);
     $this->assertSame(2, $count);
     // Forum topic count hidden.
     $count = bbp_get_forum_topic_count_hidden($f, true);
     $this->assertSame(2, $count);
 }
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:96,代码来源:tools.php


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