本文整理汇总了PHP中bbp_has_topics函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_has_topics函数的具体用法?PHP bbp_has_topics怎么用?PHP bbp_has_topics使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_has_topics函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_bbp_get_user_favorites
/**
* @covers ::bbp_get_user_favorites
*/
public function test_bbp_get_user_favorites()
{
$u = $this->factory->user->create();
$t = $this->factory->topic->create_many(3);
// Add topic favorites.
bbp_add_user_favorite($u, $t[0]);
bbp_add_user_favorite($u, $t[1]);
bbp_add_user_favorite($u, $t[2]);
$expected = bbp_has_topics(array('post__in' => array($t[0], $t[1], $t[2])));
$favorites = bbp_get_user_favorites($u);
$this->assertEquals($expected, $favorites);
// Remove user favorite.
bbp_remove_user_favorite($u, $t[1]);
$expected = bbp_has_topics(array('post__in' => array($t[0], $t[2])));
$favorites = bbp_get_user_favorites($u);
$this->assertEquals($expected, $favorites);
}
示例2: getTopicList
public function getTopicList()
{
if (is_null($_POST['param']) || empty($_POST['param'])) {
$this->_die();
}
$return = array();
$loadFrom = empty($_POST['param']['from']) ? 0 : $_POST['param']['from'];
$loadTo = empty($_POST['param']['to']) ? 0 : $_POST['param']['to'];
$param = array('post_parent' => $this->forumId);
if (!bbp_has_topics($param)) {
$this->_die();
}
while (bbp_topics()) {
bbp_the_topic();
$topicId = bbp_get_topic_id();
$topic = new ForumBbpAjaxIntegratorPost($topicId, 'topic');
$returnItem = $topic->getPostData();
$returnItem['replyList'] = $this->getReplyList($topicId);
$return[] = $returnItem;
}
wp_die(json_encode($return));
}
示例3: st_bbp_get_user_topics_started
function st_bbp_get_user_topics_started($user_id = 0, $limit = 3, $max_num_pages = 1)
{
// Validate user
$user_id = bbp_get_user_id($user_id);
if (empty($user_id)) {
return false;
}
// Query defaults
$default_query = array('author' => $user_id, 'show_stickies' => false, 'order' => 'DESC', 'posts_per_page' => $limit, 'max_num_pages' => $max_num_pages);
// Try to get the topics
$query = bbp_has_topics($default_query);
if (empty($query)) {
return false;
}
return apply_filters('bbp_get_user_topics_started', $query, $user_id);
}
示例4: the_ID
?>
<div id="post-<?php
the_ID();
?>
" <?php
post_class();
?>
>
<div class="entry-content">
<div id="bbpress-forums">
<?php
if (bbp_has_topics($args)) {
?>
<?php
bbp_get_template_part('loop', 'topics');
?>
<?php
bbp_get_template_part('pagination', 'topics');
?>
<?php
} else {
?>
Sorry, no results found for <strong><?php
示例5: display_forums
//.........这里部分代码省略.........
<?php
} else {
?>
<?php
bbp_get_template_part('feedback', 'no-topics');
?>
<?php
bbp_get_template_part('form', 'topic');
?>
<?php
}
// More than 1 forum found or group forum admin screen
} elseif (1 < $bbp->forum_query->post_count) {
?>
<h3><?php
_e('Forums', 'bbpress');
?>
</h3>
<?php
bbp_get_template_part('loop', 'forums');
?>
<h3><?php
_e('Topics', 'bbpress');
?>
</h3>
<?php
if (bbp_has_topics(array('post_parent__in' => $forum_ids))) {
?>
<?php
bbp_get_template_part('pagination', 'topics');
?>
<?php
bbp_get_template_part('loop', 'topics');
?>
<?php
bbp_get_template_part('pagination', 'topics');
?>
<?php
bbp_get_template_part('form', 'topic');
?>
<?php
} else {
?>
<?php
bbp_get_template_part('feedback', 'no-topics');
?>
<?php
bbp_get_template_part('form', 'topic');
?>
<?php
}
示例6: do_action
<?php
do_action('bbp_after_statistics');
?>
</dl>
<?php
do_action('bbp_before_popular_topics');
?>
<?php
bbp_set_query_name('bbp_popular_topics');
?>
<?php
if (bbp_has_topics(array('meta_key' => '_bbp_reply_count', 'posts_per_page' => 15, 'max_num_pages' => 1, 'orderby' => 'meta_value_num', 'show_stickies' => false))) {
?>
<h2 class="entry-title"><?php
_e('Popular Topics', 'bbpress');
?>
</h2>
<?php
bbp_get_template_part('bbpress/pagination', 'topics');
?>
<?php
bbp_get_template_part('bbpress/loop', 'topics');
?>
示例7: bbp_display_topics_feed_rss2
/**
* Output an RSS2 feed of topics, based on the query passed.
*
* @since bbPress (r3171)
*
* @uses bbp_version()
* @uses bbp_is_single_topic()
* @uses bbp_user_can_view_forum()
* @uses bbp_get_topic_forum_id()
* @uses bbp_show_load_topic()
* @uses bbp_topic_permalink()
* @uses bbp_topic_title()
* @uses bbp_get_topic_reply_count()
* @uses bbp_topic_content()
* @uses bbp_has_topics()
* @uses bbp_topics()
* @uses bbp_the_topic()
* @uses get_wp_title_rss()
* @uses get_option()
* @uses bloginfo_rss
* @uses self_link()
* @uses the_author()
* @uses get_post_time()
* @uses rss_enclosure()
* @uses do_action()
* @uses apply_filters()
*
* @param array $topics_query
*/
function bbp_display_topics_feed_rss2($topics_query = array())
{
// User cannot access this forum
if (bbp_is_single_forum() && !bbp_user_can_view_forum(array('forum_id' => bbp_get_forum_id()))) {
return;
}
// Display the feed
header('Content-Type: ' . feed_content_type('rss2') . '; charset=' . get_option('blog_charset'), true);
header('Status: 200 OK');
echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
<?php
do_action('bbp_feed');
?>
>
<channel>
<title><?php
bloginfo_rss('name');
?>
» <?php
_e('All Topics', 'bbpress');
?>
</title>
<atom:link href="<?php
self_link();
?>
" rel="self" type="application/rss+xml" />
<link><?php
self_link();
?>
</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>
//.........这里部分代码省略.........
示例8: bbp_view_query
/**
* Run the view's query
*
* @since 2.0.0 bbPress (r2789)
*
* @param string $view Optional. View id
* @param mixed $new_args New arguments. See {@link bbp_has_topics()}
* @uses bbp_get_view_id() To get the view id
* @uses bbp_get_view_query_args() To get the view query args
* @uses sanitize_title() To sanitize the view name
* @uses bbp_has_topics() To make the topics query
* @return bool False if the view doesn't exist, otherwise if topics are there
*/
function bbp_view_query($view = '', $new_args = '')
{
$view = bbp_get_view_id($view);
if (empty($view)) {
return false;
}
$query_args = bbp_get_view_query_args($view);
if (!empty($new_args)) {
$new_args = bbp_parse_args($new_args, '', 'view_query');
$query_args = array_merge($query_args, $new_args);
}
return bbp_has_topics($query_args);
}
示例9: get_header
*/
?>
<?php
get_header();
?>
<div id="content" role="main">
<?php
apoc_breadcrumbs();
?>
<div id="forums">
<?php
// Recent topics found
if (bbp_has_topics(array('post_parent__not_in' => array(5459), 'meta_value' => date('Y-m-d', strtotime('-30 days')), 'meta_compare' => '>='))) {
?>
<?php
bbp_get_template_part('loop', 'topics');
?>
<?php
bbp_get_template_part('pagination', 'topics');
?>
<?php
// No topics found
} else {
?>
<p class="warning">Sorry, but no recent topics were found.</p>
<?php
示例10: bbp_show_lead_topic
?>
</li>
<li class="bbp-topic-reply-count"><?php
bbp_show_lead_topic() ? _e('Replies', 'bbpress') : _e('Posts', 'bbpress');
?>
</li>
<li class="bbp-topic-freshness"><?php
_e('Freshness', 'bbpress');
?>
</li>
</ul>
<div class="clearfix"></div>
</li>
<?php
if (strpos($_SERVER['REQUEST_URI'], '/forums/view/') || bbp_has_topics($bbp_loop_args)) {
?>
<?php
while (bbp_topics()) {
bbp_the_topic();
?>
<?php
bbp_get_template_part('loop', 'single-topic');
?>
<?php
}
?>
<?php
}
示例11: load_more_topics
function load_more_topics()
{
$content = '';
ob_start();
$forum_id = $_POST['forum'];
if ($topics = bbp_has_topics(array('post_parent' => $forum_id, 'posts_per_page' => 11, 'paged' => $_POST['list']))) {
$counter = 0;
while (bbp_topics()) {
bbp_the_topic();
if (++$counter == 12) {
break;
}
?>
<div class="topics_list_single_topic <?php
$postUser = new WP_User(bbp_get_topic_author_id());
echo $postUser->has_cap('bbp_keymaster') || $postUser->has_cap('bbp_moderator') ? "isAdmin" : "";
?>
"
id="topic-<?php
echo bbp_get_topic_id();
?>
"
data-bbp_forum_id="<?php
echo $forum_id;
?>
"
data-id="<?php
echo bbp_get_topic_id();
?>
">
<div class="single_topic_header">
<div class="photo">
<a
href="<?php
echo bp_core_get_user_domain(bbp_get_topic_author_id());
?>
"><?php
echo bp_core_fetch_avatar(array('item_id' => bbp_get_topic_author_id(), 'height' => 40, 'width' => 40));
?>
</a>
</div>
<div class="info">
<div class="name">
<a
href="<?php
echo bp_core_get_user_domain(bbp_get_topic_author_id());
?>
"><?php
echo bbp_get_topic_author_display_name(bbp_get_topic_id());
?>
</a>
<?php
if ($postUser->has_cap('bbp_keymaster')) {
echo "<small>(Администратор форума)</small>";
} elseif ($postUser->has_cap('bbp_moderator')) {
echo "<small>(Преподаватель)</small>";
}
?>
</div>
<div class="date"><?php
echo get_post_time('j F ', false, bbp_get_topic_id(), true) . __('at', 'qode') . get_post_time(' H:i', false, bbp_get_topic_id(), true);
?>
</div>
</div>
<?php
if (bbp_get_topic_author_id() == get_current_user_id()) {
?>
<a href="#" class="addi_actions_open"></a>
<div class="addi_actions" style="display: none">
<ul>
<li><a class="edit_action" href="#">Редактировать</a></li>
<li><a class="remove_action" href="#">Удалить</a></li>
</ul>
</div>
<?php
}
?>
</div>
<div class="single_topic_content">
<?php
$content = bbp_get_topic_content();
if (mb_strlen($content) > 500) {
echo '<div class="show">' . mb_substr($content, 0, 500) . '... <a href="#" class="show_all">' . __('More', 'qode') . '</a></div>';
?>
<div class="hide"><?php
echo $content;
?>
</div>
<?php
} else {
echo $content;
}
?>
</div>
<div style="display: none" class="single_topic_content_edit">
<textarea class="edit_content"><?php
echo get_post_field('post_content', bbp_get_topic_id());
?>
</textarea>
//.........这里部分代码省略.........
示例12: test_bbp_get_user_topic_subscriptions
/**
* @covers ::bbp_get_user_topic_subscriptions
*/
public function test_bbp_get_user_topic_subscriptions()
{
$u = $this->factory->user->create();
$t = $this->factory->topic->create_many(3);
// Add topic subscriptions.
bbp_add_user_topic_subscription($u, $t[0]);
bbp_add_user_topic_subscription($u, $t[1]);
bbp_add_user_topic_subscription($u, $t[2]);
$expected = bbp_has_topics(array('post__in' => array($t[0], $t[1], $t[2])));
$subscriptions = bbp_get_user_topic_subscriptions($u);
$this->assertEquals($expected, $subscriptions);
// Remove topic subscription.
bbp_remove_user_topic_subscription($u, $t[1]);
$expected = bbp_has_topics(array('post__in' => array($t[0], $t[2])));
$subscriptions = bbp_get_user_topic_subscriptions($u);
$this->assertEquals($expected, $subscriptions);
}
示例13: bloginfo
?>
<?php
// Topic Loop
?>
<section class="section-wrap topics row-vertical">
<a href="<?php
bloginfo('url');
?>
/forums"><h1 class="section-header">Recent Topics</h1></a>
<?php
do_action('bbp_template_before_topics_index');
?>
<?php
if (bbp_has_topics(array('author' => 0, 'show_stickies' => false, 'order' => 'DESC', 'post_parent' => 'any', 'posts_per_page' => 3))) {
?>
<?php
bbp_get_template_part('loop', 'topics');
?>
<?php
} else {
?>
<?php
bbp_get_template_part('feedback', 'no-topics');
?>
<?php
示例14: display_forums
/**
* Output the forums for a group in the edit screens
*
* @since bbPress (r3653)
* @uses bp_get_current_group_id()
* @uses bbp_get_group_forum_ids()
* @uses bbp_has_forums()
* @uses bbp_get_template_part()
*/
public function display_forums($offset = 0)
{
global $wpdb;
$bbp = bbpress();
// Forum data
$forum_ids = bbp_get_group_forum_ids(bp_get_current_group_id());
$forum_args = array('post__in' => $forum_ids, 'post_parent' => null);
?>
<div id="bbpress-forums">
<?php
// Looking at the group forum root
if (!bp_action_variable($offset)) {
// Query forums and show them if
if (!empty($forum_ids) && bbp_has_forums($forum_args)) {
bbp_the_forum();
// Only one forum found
if ($bbp->forum_query->post_count == 1) {
?>
<h3><?php
_e('Forum', 'bbpress');
?>
</h3>
<?php
bbp_set_query_name('bbp_single_forum');
?>
<?php
if (bbp_has_topics(array('post_parent' => bbp_get_forum_id()))) {
?>
<?php
bbp_get_template_part('pagination', 'topics');
?>
<?php
bbp_get_template_part('loop', 'topics');
?>
<?php
bbp_get_template_part('pagination', 'topics');
?>
<?php
bbp_get_template_part('form', 'topic');
?>
<?php
} else {
?>
<?php
bbp_get_template_part('feedback', 'no-topics');
?>
<?php
bbp_get_template_part('form', 'topic');
?>
<?php
}
// More than 1 forum found
} elseif ($bbp->forum_query->post_count > 1) {
?>
<h3><?php
_e('Forums', 'bbpress');
?>
</h3>
<?php
bbp_get_template_part('loop', 'forums');
?>
<h3><?php
_e('Topics', 'bbpress');
?>
</h3>
<?php
if (bbp_has_topics(array('post_parent__in' => $forum_ids))) {
?>
<?php
bbp_get_template_part('pagination', 'topics');
?>
<?php
//.........这里部分代码省略.........
示例15: bbp_get_user_topics_started
/**
* Get the topics that a user created
*
* @since bbPress (r2660)
*
* @param int $user_id Optional. User id
* @uses bbp_get_user_id() To get the topic id
* @uses bbp_has_topics() To get the topics created by the user
* @return array|bool Results if the user has created topics, otherwise false
*/
function bbp_get_user_topics_started($user_id = 0)
{
// Validate user
$user_id = bbp_get_user_id($user_id);
if (empty($user_id)) {
return false;
}
// Try to get the topics
$query = bbp_has_topics(array('author' => $user_id));
return apply_filters('bbp_get_user_topics_started', $query, $user_id);
}