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


PHP bbp_get_forum_last_active_id函数代码示例

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


在下文中一共展示了bbp_get_forum_last_active_id函数的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_update_forum_last_active_id

 /**
  * @covers ::bbp_update_forum_last_active_id
  */
 public function test_bbp_update_forum_last_active_id()
 {
     $f1 = $this->factory->forum->create();
     $f2 = $this->factory->forum->create(array('post_parent' => $f1));
     $t1 = $this->factory->topic->create(array('post_parent' => $f1, 'topic_meta' => array('forum_id' => $f1)));
     $r1 = $this->factory->reply->create(array('post_parent' => $t1, 'reply_meta' => array('forum_id' => $f1, 'topic_id' => $t1)));
     $id = bbp_update_forum_last_active_id($f1, $r1);
     $this->assertSame($r1, $id);
     $id = bbp_get_forum_last_active_id($f1);
     $this->assertSame($r1, $id);
     $t2 = $this->factory->topic->create(array('post_parent' => $f2, 'topic_meta' => array('forum_id' => $f2)));
     $r2 = $this->factory->reply->create(array('post_parent' => $t2, 'reply_meta' => array('forum_id' => $f2, 'topic_id' => $t2)));
     bbp_update_forum_last_active_id($f2);
     $id = bbp_get_forum_last_active_id($f2);
     $this->assertSame($r2, $id);
     bbp_update_forum_last_active_id($f1);
     $id = bbp_get_forum_last_active_id($f1);
     $this->assertSame($r2, $id);
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:22,代码来源:update-last-thing.php

示例3: bbp_get_single_forum_description

/**
 * Return a fancy description of the current forum, including total
 * topics, total replies, and last activity.
 *
 * @since bbPress (r2860)
 *
 * @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_subforum_count() To get the forum subforum 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 bbp_get_single_forum_description($args = '')
{
    // Default arguments
    $defaults = array('forum_id' => 0, 'before' => '<div class="bbp-template-notice info"><p class="bbp-forum-description">', 'after' => '</p></div>', 'size' => 14, 'feed' => true);
    $r = bbp_parse_args($args, $defaults, 'get_single_forum_description');
    extract($r);
    // Validate forum_id
    $forum_id = bbp_get_forum_id($forum_id);
    // Unhook the 'view all' query var adder
    remove_filter('bbp_get_forum_permalink', 'bbp_add_view_all');
    // Get some forum data
    $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', $reply_count, 'bbpress'), $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' => $size));
        // Forum has no last active data
    } else {
        $topic_text = sprintf(_n('%s topic', '%s topics', $topic_count, 'bbpress'), $topic_count);
    }
    // Forum has active data
    if (!empty($last_active)) {
        if (!empty($reply_count)) {
            if (bbp_is_forum_category($forum_id)) {
                $retstr = sprintf(__('This category contains %1$s and %2$s, and was last updated by %3$s %4$s.', 'bbpress'), $topic_text, $reply_text, $last_updated_by, $time_since);
            } else {
                $retstr = sprintf(__('This forum contains %1$s and %2$s, and was last updated by %3$s %4$s.', 'bbpress'), $topic_text, $reply_text, $last_updated_by, $time_since);
            }
        } else {
            if (bbp_is_forum_category($forum_id)) {
                $retstr = sprintf(__('This category contains %1$s, and was last updated by %2$s %3$s.', 'bbpress'), $topic_text, $last_updated_by, $time_since);
            } else {
                $retstr = sprintf(__('This forum contains %1$s, and was last updated by %2$s %3$s.', 'bbpress'), $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(__('This category contains %1$s and %2$s.', 'bbpress'), $topic_text, $reply_text);
            } else {
                $retstr = sprintf(__('This forum contains %1$s and %2$s.', 'bbpress'), $topic_text, $reply_text);
            }
        } else {
            if (!empty($topic_count)) {
                if (bbp_is_forum_category($forum_id)) {
                    $retstr = sprintf(__('This category contains %1$s.', 'bbpress'), $topic_text);
                } else {
                    $retstr = sprintf(__('This forum contains %1$s.', 'bbpress'), $topic_text);
                }
            } else {
                $retstr = __('This forum is empty.', 'bbpress');
            }
        }
    }
    // Add feeds
    //$feed_links = ( !empty( $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 = $before . $retstr . $after;
    // Return filtered result
    return apply_filters('bbp_get_single_forum_description', $retstr, $args);
}
开发者ID:hscale,项目名称:webento,代码行数:94,代码来源:bbp-forum-template.php

示例4: bbp_show_lead_topic

?>
</div>
		<div class="topic-reply-counts">Inlägg: <?php 
bbp_show_lead_topic() ? bbp_forum_reply_count() : bbp_forum_post_count();
?>
</div>
	</li>

	<li class="bbp-forum-freshness col-lg-3">

		<div class="last-posted-topic-title">
			<a href="<?php 
echo bbp_get_forum_last_topic_permalink();
?>
"><?php 
echo bbp_get_topic_last_reply_title(bbp_get_forum_last_active_id());
?>
</a>
		</div>
		<div class="last-posted-topic-user">av 
		<span class="bbp-author-avatar"><?php 
echo get_avatar(bbp_get_forum_last_reply_author_id(), '14');
?>
 </span>
			<?php 
echo bbp_get_user_profile_link(bbp_get_forum_last_reply_author_id());
?>
		</div>
		<div class="last-posted-topic-time">
			<?php 
echo bbp_get_forum_last_active_time();
开发者ID:melgar3d,项目名称:wpsvse,代码行数:31,代码来源:loop-single-forum.php

示例5: firmasite_social_bbp_get_forum_freshness_link

function firmasite_social_bbp_get_forum_freshness_link($forum_id = 0)
{
    $forum_id = bbp_get_forum_id($forum_id);
    $active_id = bbp_get_forum_last_active_id($forum_id);
    if (empty($active_id)) {
        $active_id = bbp_get_forum_last_reply_id($forum_id);
    }
    if (empty($active_id)) {
        $active_id = bbp_get_forum_last_topic_id($forum_id);
    }
    if (bbp_is_topic($active_id)) {
        $link_url = bbp_get_forum_last_topic_permalink($forum_id);
        $title = bbp_get_forum_last_topic_title($forum_id);
    } elseif (bbp_is_reply($active_id)) {
        $link_url = bbp_get_forum_last_reply_url($forum_id);
        $title = bbp_get_forum_last_reply_title($forum_id);
    }
    $time_since = bbp_get_forum_last_active_time($forum_id);
    if (!empty($time_since) && !empty($link_url)) {
        $anchor = '<a href="' . $link_url . '" data-toggle="popover" data-rel="popover" data-placement="left" data-trigger="hover" data-html="true" data-original-title="' . __('Freshness', 'firmasite') . '" data-content="' . esc_attr($time_since) . '"><i class="icon-time"></i></a>&nbsp;' . __('Freshness', 'firmasite') . ':';
    } else {
        $anchor = __('No Topics', 'firmasite');
    }
    return apply_filters('bbp_get_forum_freshness_link', $anchor, $forum_id);
}
开发者ID:jason-herndon,项目名称:bas-intranet,代码行数:25,代码来源:bbpress.php

示例6: test_bbp_get_forum_last_active_id_with_pending_reply

 /**
  * @covers ::bbp_forum_last_active_id
  * @covers ::bbp_get_forum_last_active_id
  */
 public function test_bbp_get_forum_last_active_id_with_pending_reply()
 {
     $u = $this->factory->user->create_many(2);
     $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')));
     // Get the forums last active id.
     $last_id = bbp_get_forum_last_active_id($f);
     $this->assertSame(0, $last_id);
     // Get the categories last active id.
     $last_id = bbp_get_forum_last_active_id($c);
     $this->assertSame(0, $last_id);
     bbp_update_forum_last_active_id($f);
     // Get the forums last active id.
     $last_id = bbp_get_forum_last_active_id($f);
     $this->assertSame(0, $last_id);
     // Get the categories last active id.
     $last_id = bbp_get_forum_last_active_id($c);
     $this->assertSame(0, $last_id);
     $t = $this->factory->topic->create(array('post_parent' => $f, 'topic_meta' => array('forum_id' => $f)));
     bbp_update_forum_last_active_id($f);
     // Get the forums last active id.
     $last_id = bbp_get_forum_last_active_id($f);
     $this->assertSame($t, $last_id);
     // Get the categories last active id.
     $last_id = bbp_get_forum_last_active_id($c);
     $this->assertSame($t, $last_id);
     $r1 = $this->factory->reply->create(array('post_parent' => $t, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     bbp_update_forum_last_active_id($f);
     // Get the forums last active id.
     $last_id = bbp_get_forum_last_active_id($f);
     $this->assertSame($r1, $last_id);
     // Get the categories last active id.
     $last_id = bbp_get_forum_last_active_id($c);
     $this->assertSame($r1, $last_id);
     $r2 = $this->factory->reply->create(array('post_parent' => $t, 'post_author' => $u[1], 'post_status' => bbp_get_pending_status_id(), 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t)));
     // Get the forums last active id.
     $last_id = bbp_get_forum_last_active_id($f);
     $this->assertSame($r1, $last_id);
     // Get the categories last active id.
     $last_id = bbp_get_forum_last_active_id($c);
     $this->assertSame($r1, $last_id);
     bbp_approve_reply($r2);
     // Get the forums last active id.
     $last_id = bbp_get_forum_last_active_id($f);
     $this->assertSame($r2, $last_id);
     // Get the categories last active id.
     $last_id = bbp_get_forum_last_active_id($c);
     $this->assertSame($r2, $last_id);
 }
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:53,代码来源:get-last-thing.php

示例7: bbp_forum_freshness_link

		<?php 
bbp_forum_freshness_link();
?>

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

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

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

			<span class="bbp-topic-freshness-author"><?php 
bbp_author_link(array('post_id' => bbp_get_forum_last_active_id(), 'type' => name));
?>
</span>

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

		</p>
	</li>

</ul><!-- #bbp-forum-<?php 
bbp_forum_id();
?>
 -->
开发者ID:newmight2015,项目名称:psmpsm,代码行数:30,代码来源:loop-single-forum.php

示例8: 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

示例9: 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

示例10: bbp_update_reply_walker

/**
 * Walk up the ancestor tree from the current reply, and update all the counts
 *
 * @since 2.0.0 bbPress (r2884)
 *
 * @param int $reply_id Optional. Reply id
 * @param string $last_active_time Optional. Last active time
 * @param int $forum_id Optional. Forum id
 * @param int $topic_id Optional. Topic id
 * @param bool $refresh If set to true, unsets all the previous parameters.
 *                       Defaults to true
 * @uses bbp_get_reply_id() To get the reply id
 * @uses bbp_get_reply_topic_id() To get the reply topic id
 * @uses bbp_get_reply_forum_id() To get the reply forum id
 * @uses get_post_ancestors() To get the ancestors of the reply
 * @uses bbp_is_reply() To check if the ancestor is a reply
 * @uses bbp_is_topic() To check if the ancestor is a topic
 * @uses bbp_update_topic_last_reply_id() To update the topic last reply id
 * @uses bbp_update_topic_last_active_id() To update the topic last active id
 * @uses bbp_get_topic_last_active_id() To get the topic last active id
 * @uses get_post_field() To get the post date of the last active id
 * @uses bbp_update_topic_last_active_time() To update the last active topic meta
 * @uses bbp_update_topic_voice_count() To update the topic voice count
 * @uses bbp_update_topic_reply_count() To update the topic reply count
 * @uses bbp_update_topic_reply_count_hidden() To update the topic hidden reply
 *                                              count
 * @uses bbp_is_forum() To check if the ancestor is a forum
 * @uses bbp_update_forum_last_topic_id() To update the last topic id forum meta
 * @uses bbp_update_forum_last_reply_id() To update the last reply id forum meta
 * @uses bbp_update_forum_last_active_id() To update the forum last active id
 * @uses bbp_get_forum_last_active_id() To get the forum last active id
 * @uses bbp_update_forum_last_active_time() To update the forum last active time
 * @uses bbp_update_forum_reply_count() To update the forum reply count
 */
function bbp_update_reply_walker($reply_id, $last_active_time = '', $forum_id = 0, $topic_id = 0, $refresh = true)
{
    // Verify the reply ID
    $reply_id = bbp_get_reply_id($reply_id);
    // Reply was passed
    if (!empty($reply_id)) {
        // Get the topic ID if none was passed
        if (empty($topic_id)) {
            $topic_id = bbp_get_reply_topic_id($reply_id);
            // Make every effort to get topic id
            // https://bbpress.trac.wordpress.org/ticket/2529
            if (empty($topic_id) && current_filter() === 'bbp_deleted_reply') {
                $topic_id = get_post_field('post_parent', $reply_id);
            }
        }
        // Get the forum ID if none was passed
        if (empty($forum_id)) {
            $forum_id = bbp_get_reply_forum_id($reply_id);
        }
    }
    // Set the active_id based on topic_id/reply_id
    $active_id = empty($reply_id) ? $topic_id : $reply_id;
    // Setup ancestors array to walk up
    $ancestors = array_values(array_unique(array_merge(array($topic_id, $forum_id), (array) get_post_ancestors($topic_id))));
    // If we want a full refresh, unset any of the possibly passed variables
    if (true === $refresh) {
        $forum_id = $topic_id = $reply_id = $active_id = $last_active_time = 0;
    }
    // Walk up ancestors
    if (!empty($ancestors)) {
        foreach ($ancestors as $ancestor) {
            // Reply meta relating to most recent reply
            if (bbp_is_reply($ancestor)) {
                // @todo - hierarchical replies
                // Topic meta relating to most recent reply
            } elseif (bbp_is_topic($ancestor)) {
                // Last reply and active ID's
                bbp_update_topic_last_reply_id($ancestor, $reply_id);
                bbp_update_topic_last_active_id($ancestor, $active_id);
                // Get the last active time if none was passed
                $topic_last_active_time = $last_active_time;
                if (empty($last_active_time)) {
                    $topic_last_active_time = get_post_field('post_date', bbp_get_topic_last_active_id($ancestor));
                }
                // Update the topic last active time regardless of reply status.
                // See https://bbpress.trac.wordpress.org/ticket/2838
                bbp_update_topic_last_active_time($ancestor, $topic_last_active_time);
                // Counts
                bbp_update_topic_voice_count($ancestor);
                // Only update reply count if we're deleting a reply, or in the dashboard.
                if (in_array(current_filter(), array('bbp_deleted_reply', 'save_post'), true)) {
                    bbp_update_topic_reply_count($ancestor);
                    bbp_update_topic_reply_count_hidden($ancestor);
                }
                // Forum meta relating to most recent topic
            } elseif (bbp_is_forum($ancestor)) {
                // Last topic and reply ID's
                bbp_update_forum_last_topic_id($ancestor, $topic_id);
                bbp_update_forum_last_reply_id($ancestor, $reply_id);
                // Last Active
                bbp_update_forum_last_active_id($ancestor, $active_id);
                // Get the last active time if none was passed
                $forum_last_active_time = $last_active_time;
                if (empty($last_active_time)) {
                    $forum_last_active_time = get_post_field('post_date', bbp_get_forum_last_active_id($ancestor));
                }
//.........这里部分代码省略.........
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:101,代码来源:functions.php

示例11: bbp_get_reply_author_id

					// Get the author 
			$user_id 		= bbp_get_reply_author_id( $reply_id );

					// Toggle html class?>

			<tr>
				<td><a class="bbp-forum-title" href="<?php echo $permalink; ?>"><?php echo $title; ?></a></td>
				<td><?php echo $topics; ?></td>
				<td><?php bbp_forum_post_count( $sub_id, true ); ?></td>
				<td><p class="bbp-topic-meta">

					<?php do_action( 'bbp_theme_before_topic_author' ); ?>
					<a class="freshest-title" href="<?php echo $link; ?>" title="<?php echo $topic_title; ?>"><?php echo $topic_title; ?></a>


					<span class="bbp-topic-freshness-author">By <?php bbp_author_link( array( 'post_id' => bbp_get_forum_last_active_id(), 'size' => 14 ) ); ?></span>

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

				</p>

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

				<span class="freshest-time"><?php bbp_topic_last_active_time( $topic_id ); ?></span>

				<?php do_action( 'bbp_theme_after_forum_freshness_link' ); ?></td>
			</tr>


		<?php endforeach; ?>
开发者ID:niamherinoc,项目名称:rctractors,代码行数:30,代码来源:loop-single-forum.php

示例12: custom_freshness_link

function custom_freshness_link($forum_id = 0)
{
    global $rpg_settingsf;
    $forum_id = bbp_get_forum_id($forum_id);
    $active_id = bbp_get_forum_last_active_id($forum_id);
    $link_url = $title = '';
    $forum_title = bbp_get_forum_title($forum_id);
    if (empty($active_id)) {
        $active_id = bbp_get_forum_last_reply_id($forum_id);
    }
    if (empty($active_id)) {
        $active_id = bbp_get_forum_last_topic_id($forum_id);
    }
    if (bbp_is_topic($active_id)) {
        $link_url = bbp_get_forum_last_topic_permalink($forum_id);
        //$link_id added to get post_id and type to allow for later check
        $link_id = bbp_get_forum_last_topic_id($forum_id);
        $check = "topic";
        $title = bbp_get_forum_last_topic_title($forum_id);
        $forum_id_last_active = bbp_get_topic_forum_id($active_id);
    } elseif (bbp_is_reply($active_id)) {
        $link_url = bbp_get_forum_last_reply_url($forum_id);
        //$link-id added to get post-id and type to allow for later check
        $link_id = bbp_get_forum_last_reply_id($forum_id);
        $check = "reply";
        $title = bbp_get_forum_last_reply_title($forum_id);
        $forum_id_last_active = bbp_get_reply_forum_id($active_id);
    }
    $time_since = bbp_get_forum_last_active_time($forum_id);
    if (!empty($time_since) && !empty($link_url)) {
        //ADDITIONAL CODE to original bbp_get_forum_freshness_link function
        //test if user can see this post, and post link if they can
        $user_id = wp_get_current_user()->ID;
        //get the forum id for the post - that's the forum ID against which we check to see if it is in a group - no idea what forum group the stuff above produces, suspect post id of when last changed.
        $forum_id_check = private_groups_get_forum_id_from_post_id($link_id, $check);
        //now we can check if the user can view this, and if it's not private
        if (private_groups_can_user_view_post($user_id, $forum_id_check) && !bbp_is_forum_private($forum_id_last_active)) {
            $anchor = '<a href="' . esc_url($link_url) . '" title="' . esc_attr($title) . '">' . esc_html($time_since) . '</a>';
        } elseif (private_groups_can_user_view_post($user_id, $forum_id_check) && bbp_is_forum_private($forum_id_last_active) && current_user_can('read_private_forums')) {
            $anchor = '<a href="' . esc_url($link_url) . '" title="' . esc_attr($title) . '">' . esc_html($time_since) . '</a>';
        } else {
            //set up which link to send them to
            if (!is_user_logged_in()) {
                if ($rpg_settingsf['redirect_page2']) {
                    $link = $rpg_settingsf['redirect_page2'];
                } else {
                    $link = "/wp-login";
                }
            } else {
                if ($rpg_settingsf['redirect_page1']) {
                    $link = $rpg_settingsf['redirect_page1'];
                } else {
                    $link = '/404';
                }
            }
            //now see if there is a freshness message
            if ($rpg_settingsf['set_freshness_message']) {
                $title = $rpg_settingsf['freshness_message'];
                //and set up anchor
                $anchor = '<a href="' . esc_url($link) . '">' . $title . '</a>';
            } else {
                $anchor = '<a href="' . esc_url($link) . '">' . esc_html($time_since) . '</a>';
            }
        }
    } else {
        $anchor = esc_html__('No Topics', 'bbpress');
    }
    return $anchor;
}
开发者ID:USSLomaPrieta,项目名称:usslomaprieta.org,代码行数:69,代码来源:functions.php

示例13: 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

示例14: epicwebs_get_last_poster_block

 public function epicwebs_get_last_poster_block($subforum_id = "")
 {
     if (!empty($subforum_id)) {
         // Main forum display with sub forums
         $output = "<div class='last-posted-topic-title'>";
         $output .= "<a href='" . bbp_get_forum_last_topic_permalink($subforum_id) . "'>" . bbp_get_topic_last_reply_title(bbp_get_forum_last_active_id($subforum_id)) . "</a>";
         $output .= "</div>";
         $output .= "<div class='last-posted-topic-user'>av ";
         $author_id = bbp_get_forum_last_reply_author_id($subforum_id);
         $output .= "<span class=\"bbp-author-avatar\">" . get_avatar($author_id, '14') . "&nbsp;</span>";
         $output .= bbp_get_user_profile_link($author_id);
         $output .= "</div>";
         $output .= "<div class='last-posted-topic-time'>";
         $output .= bbp_get_forum_last_active_time($subforum_id);
         $output .= "</div>";
     } else {
         // forum category display (no sub forums list)
         $output = "<div class='last-posted-topic-title'>";
         $output .= "<a href='" . bbp_get_forum_last_topic_permalink() . "'>" . bbp_get_topic_last_reply_title(bbp_get_forum_last_active_id()) . "</a>";
         $output .= "</div>";
         $output .= "<div class='last-posted-topic-user'>av ";
         $output .= "<span class=\"bbp-author-avatar\">" . get_avatar(bbp_get_forum_last_reply_author_id(), '14') . "&nbsp;</span>";
         $output .= bbp_get_user_profile_link(bbp_get_forum_last_reply_author_id());
         $output .= "</div>";
         $output .= "<div class='last-posted-topic-time'>";
         $output .= bbp_get_forum_last_active_time();
         $output .= "</div>";
     }
     return $output;
 }
开发者ID:melgar3d,项目名称:wpsvse,代码行数:30,代码来源:bbpress-functions.php

示例15: bbp_forum_topic_count

?>
">
				
				

				<div class="bb-forum-meta clearfix">
					<span class="bbp-forum-topic-count"><?php 
bbp_forum_topic_count();
?>
 <span class="topic-count">topics</span></span>
					<span class="bbp-forum-reply-count"><?php 
bbp_show_lead_topic() ? bbp_forum_reply_count() : bbp_forum_post_count();
?>
<span class="reply-count"> replies</span></span>
					<?php 
if (bbp_get_forum_last_active_id() > 0) {
    ?>
							<span class="bbp-forum-freshness">
								<?php 
    do_action('bbp_theme_before_forum_freshness_link');
    ?>
									<?php 
    bbp_forum_freshness_link();
    ?>
								<?php 
    do_action('bbp_theme_after_forum_freshness_link');
    ?>
							</span>
					<?php 
}
?>
开发者ID:severnrescue,项目名称:web,代码行数:31,代码来源:loop-single-forum.php


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