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


PHP bbp_topics函数代码示例

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


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

示例1: 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));
 }
开发者ID:Bnei-Baruch,项目名称:Forum-bbpres-,代码行数:22,代码来源:forum-bbpAjaxIntegrator.php

示例2: bbp_show_lead_topic

			<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('Last Post', 'cubell');
?>
</li>
		</ul>

	</li>

	<li class="bbp-body">

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

			<?php 
    bbp_get_template_part('loop', 'single-topic');
    ?>

		<?php 
}
?>

	</li>

</ul><!-- #bbp-forum-<?php 
bbp_forum_id();
开发者ID:luskyj89,项目名称:mt-wordpress,代码行数:31,代码来源:loop-topics.php

示例3: 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');
    ?>
 &#187; <?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>
//.........这里部分代码省略.........
开发者ID:jenia-buianov,项目名称:all_my_sites,代码行数:101,代码来源:functions.php

示例4: display_forums

        /**
         * Output the forums for a group in the edit screens
         *
         * As of right now, bbPress only supports 1-to-1 group forum relationships.
         * In the future, many-to-many should be allowed.
         *
         * @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 $wp_query;
            // Allow actions immediately before group forum output
            do_action('bbp_before_group_forum_display');
            // Load up bbPress once
            $bbp = bbpress();
            /** Query Resets ******************************************************/
            // Forum data
            $forum_action = bp_action_variable($offset);
            $forum_ids = bbp_get_group_forum_ids(bp_get_current_group_id());
            $forum_id = array_shift($forum_ids);
            // Always load up the group forum
            bbp_has_forums(array('p' => $forum_id, 'post_parent' => null));
            // Set the global forum ID
            $bbp->current_forum_id = $forum_id;
            // Assume forum query
            bbp_set_query_name('bbp_single_forum');
            ?>

		<div id="bbpress-forums">

			<?php 
            switch ($forum_action) {
                /** Single Forum **********************************************/
                case false:
                case 'page':
                    // Strip the super stickies from topic query
                    add_filter('bbp_get_super_stickies', array($this, 'no_super_stickies'), 10, 1);
                    // Unset the super sticky option on topic form
                    add_filter('bbp_get_topic_types', array($this, 'unset_super_sticky'), 10, 1);
                    // Query forums and show them if they exist
                    if (bbp_forums()) {
                        // Setup the forum
                        bbp_the_forum();
                        ?>

						<h3><?php 
                        bbp_forum_title();
                        ?>
</h3>

						<?php 
                        bbp_get_template_part('content', 'single-forum');
                        // No forums found
                    } else {
                        ?>

						<div id="message" class="info">
							<p><?php 
                        esc_html_e('This group does not currently have a forum.', 'bbpress');
                        ?>
</p>
						</div>

					<?php 
                    }
                    break;
                    /** Single Topic **********************************************/
                /** Single Topic **********************************************/
                case $this->topic_slug:
                    // hide the 'to front' admin links
                    add_filter('bbp_get_topic_stick_link', array($this, 'hide_super_sticky_admin_link'), 10, 2);
                    // Get the topic
                    bbp_has_topics(array('name' => bp_action_variable($offset + 1), 'posts_per_page' => 1, 'show_stickies' => false));
                    // If no topic, 404
                    if (!bbp_topics()) {
                        bp_do_404(bbp_get_forum_permalink($forum_id));
                        ?>
						<h3><?php 
                        bbp_forum_title();
                        ?>
</h3>
						<?php 
                        bbp_get_template_part('feedback', 'no-topics');
                        return;
                    }
                    // Setup the topic
                    bbp_the_topic();
                    ?>

					<h3><?php 
                    bbp_topic_title();
                    ?>
</h3>

					<?php 
                    // Topic edit
//.........这里部分代码省略.........
开发者ID:luskyj89,项目名称:mt-wordpress,代码行数:101,代码来源:groups.php

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

//.........这里部分代码省略.........
开发者ID:Bnei-Baruch,项目名称:kabacademy,代码行数:101,代码来源:functions.php


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