本文整理汇总了PHP中bbp_user_can_view_forum函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_user_can_view_forum函数的具体用法?PHP bbp_user_can_view_forum怎么用?PHP bbp_user_can_view_forum使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_user_can_view_forum函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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>
//.........这里部分代码省略.........
示例2: do_action
<?php
do_action('bbp_before_main_content');
?>
<?php
do_action('bbp_template_notices');
?>
<?php
while (have_posts()) {
the_post();
?>
<?php
if (bbp_user_can_view_forum()) {
?>
<div id="forum-<?php
bbp_forum_id();
?>
" class="bbp-forum-content">
<h1 class="entry-title"><?php
bbp_forum_title();
?>
</h1>
<div class="entry-content">
<?php
bbp_get_template_part('content', 'single-forum');
?>
示例3: bbp_display_replies_feed_rss2
/**
* Output an RSS2 feed of replies, 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_replies()
* @uses bbp_replies()
* @uses bbp_the_reply()
* @uses bbp_reply_url()
* @uses bbp_reply_title()
* @uses bbp_reply_content()
* @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 $replies_query
*/
function bbp_display_replies_feed_rss2($replies_query = array())
{
// User cannot access forum this topic is in
if (bbp_is_single_topic() && !bbp_user_can_view_forum(array('forum_id' => bbp_get_topic_forum_id()))) {
return;
}
// Adjust the title based on context
if (bbp_is_single_topic() && bbp_user_can_view_forum(array('forum_id' => bbp_get_topic_forum_id()))) {
$title = apply_filters('wp_title_rss', get_wp_title_rss(' » '));
} elseif (!bbp_show_lead_topic()) {
$title = ' » ' . __('All Posts', 'bbpress');
} else {
$title = ' » ' . __('All Replies', 'bbpress');
}
// Display the feed
header('Content-Type: ' . feed_content_type('rss-http') . '; 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');
echo $title;
?>
</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_is_single_topic()) {
//.........这里部分代码省略.........
示例4: get_header
*/
?>
<?php
get_header();
?>
<div id="container">
<div id="content-full" role="main">
<?php
do_action('bbp_template_notices');
?>
<?php
if (bbp_user_can_view_forum(array('forum_id' => bbp_get_topic_forum_id()))) {
?>
<?php
while (have_posts()) {
the_post();
?>
<div id="bbp-topic-wrapper-<?php
bbp_topic_id();
?>
" class="bbp-topic-wrapper">
<h1 class="entry-title"><?php
bbp_topic_title();
?>
</h1>
示例5: do_action
</div>
<div class="container" role="main">
<div class="row column-content-wrapper">
<div id="content" class="span12 article-container tc-gallery-style">
<article class="row-fluid">
<?php do_action( 'bbp_before_main_content' ); ?>
<?php do_action( 'bbp_template_notices' ); ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php if ( bbp_user_can_view_forum() ) : ?>
<div id="forum-<?php bbp_forum_id(); ?>" class="bbp-forum-content">
<h1 class="entry-title"><?php bbp_forum_title(); ?></h1>
<div class="entry-content">
<?php bbp_get_template_part( 'content', 'single-forum' ); ?>
</div>
</div><!-- #forum-<?php bbp_forum_id(); ?> -->
<?php else : // Forum exists, user no access ?>
<?php bbp_get_template_part( 'feedback', 'no-access' ); ?>
<?php endif; ?>
示例6: display_reply
/**
* Display the contents of a specific reply ID in an output buffer
* and return to ensure that post/page contents are displayed first.
*
* @since bbPress (r3031)
*
* @param array $attr
* @param string $content
* @uses get_template_part()
* @return string
*/
public function display_reply($attr, $content = '')
{
// Sanity check required info
if (!empty($content) || (empty($attr['id']) || !is_numeric($attr['id']))) {
return $content;
}
// Unset globals
$this->unset_globals();
// Set passed attribute to $reply_id for clarity
$reply_id = bbpress()->current_reply_id = $attr['id'];
$forum_id = bbp_get_reply_forum_id($reply_id);
// Bail if ID passed is not a reply
if (!bbp_is_reply($reply_id)) {
return $content;
}
// Reset the queries if not in theme compat
if (!bbp_is_theme_compat_active()) {
$bbp = bbpress();
// Reset necessary forum_query attributes for replys loop to function
$bbp->forum_query->query_vars['post_type'] = bbp_get_forum_post_type();
$bbp->forum_query->in_the_loop = true;
$bbp->forum_query->post = get_post($forum_id);
// Reset necessary reply_query attributes for replys loop to function
$bbp->reply_query->query_vars['post_type'] = bbp_get_reply_post_type();
$bbp->reply_query->in_the_loop = true;
$bbp->reply_query->post = get_post($reply_id);
}
// Start output buffer
$this->start('bbp_single_reply');
// Check forum caps
if (bbp_user_can_view_forum(array('forum_id' => $forum_id))) {
bbp_get_template_part('content', 'single-reply');
// Forum is private and user does not have caps
} elseif (bbp_is_forum_private($forum_id, false)) {
bbp_get_template_part('feedback', 'no-access');
}
// Return contents of output buffer
return $this->end();
}
示例7: get_header
* @package bbPress
* @subpackage Theme
*/
get_header();
?>
<section class="col-md-12">
<?php
do_action('bbp_before_main_content');
?>
<?php
do_action('bbp_template_notices');
?>
<?php
if (bbp_user_can_view_forum(array('forum_id' => bbp_get_reply_forum_id()))) {
?>
<?php
while (have_posts()) {
the_post();
?>
<div id="bbp-reply-wrapper-<?php
bbp_reply_id();
?>
" class="bbp-reply-wrapper">
<section class="new-content">
<div class="box-post">
<div class="inner-box">
<h1 class="entry-title page-title clearfix"><span><?php
示例8: template_no_access
public static function template_no_access($template)
{
global $wp_query, $post;
$check_perm = false;
if (bbp_is_single_user_edit() || bbp_is_single_user()) {
} elseif (bbp_is_forum_archive()) {
} elseif (bbp_is_forum_edit()) {
$forum_id = bbp_get_forum_id();
if (bbp_is_forum($forum_id) && !bbp_user_can_view_forum(array('forum_id' => $forum_id)) && !bbp_is_forum_private($forum_id, false)) {
$check_perm = true;
}
} elseif (bbp_is_single_forum()) {
$forum_id = bbp_get_forum_id();
if (bbp_is_forum($forum_id) && !bbp_user_can_view_forum(array('forum_id' => $forum_id)) && !bbp_is_forum_private($forum_id, false)) {
$check_perm = true;
}
} elseif (bbp_is_topic_archive()) {
} elseif (bbp_is_topic_edit() || bbp_is_single_topic()) {
$check_perm = true;
} elseif (is_post_type_archive(bbp_get_reply_post_type())) {
} elseif (bbp_is_reply_edit() || bbp_is_single_reply()) {
$check_perm = true;
} elseif (bbp_is_single_view()) {
} elseif (bbp_is_search()) {
} elseif (bbp_is_topic_tag_edit() || bbp_is_topic_tag()) {
}
if ($check_perm && empty($post->post_content)) {
$user_id = get_current_user_id();
$forum_id = bbp_get_forum_id();
if (!self::view_forum(false, $forum_id, $user_id)) {
ob_start();
bbp_get_template_part('feedback', 'no-access');
$content = ob_get_clean();
$post->post_content = "\n{$content}\n";
$wp_query->post = $post;
$wp_query->posts = array($post);
}
}
return $template;
}