本文整理汇总了PHP中bbp_get_forum_id函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_get_forum_id函数的具体用法?PHP bbp_get_forum_id怎么用?PHP bbp_get_forum_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_get_forum_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: cuttz_bbpress_layout
function cuttz_bbpress_layout($layout)
{
if (!is_bbpress()) {
return $layout;
}
//get current layout saved in genesis setting
$gsettings = get_option(GENESIS_SETTINGS_FIELD, null);
$layout = isset($gsettings['site_layout']) ? $gsettings['site_layout'] : null;
$set = genesis_get_option('bbpress-layout', cuttz_get_skin_page_id(), false);
$set = $set == 'default' ? $layout : $set;
// if no setting in Cuttz defined then use Genesis setting
$forum_id = bbp_get_forum_id();
$forumlayout = false;
if (!empty($forum_id)) {
$forumlayout = esc_attr(get_post_meta($forum_id, '_genesis_layout', true));
if (!empty($forumlayout)) {
return $forumlayout;
}
}
if (empty($forumlayout)) {
return $set;
}
if (is_user_logged_in()) {
}
return $set;
}
开发者ID:garywp,项目名称:cuttz-framework,代码行数:26,代码来源:bbpress-ready.php
示例2: pg_has_topics
function pg_has_topics($args = '')
{
//check if being called by subscriptions and if so skip filtering (as you can only subscribe to forums you can already see)
if ($args['post__in']) {
return $args;
}
$default_post_parent = bbp_is_single_forum() ? bbp_get_forum_id() : 'any';
if ($default_post_parent == 'any') {
if (bbp_is_user_keymaster()) {
return $args;
}
$user_id = wp_get_current_user()->ID;
if (user_can($user_id, 'moderate')) {
$check = get_user_meta($user_id, 'private_group', true);
if ($check == '') {
return $args;
}
}
global $wpdb;
$topic = bbp_get_topic_post_type();
$post_ids = $wpdb->get_col("select ID from {$wpdb->posts} where post_type = '{$topic}'");
//check this list against those the user is allowed to see, and create a list of valid ones for the wp_query in bbp_has_topics
$allowed_posts = check_private_groups_topic_ids($post_ids);
$args['post__in'] = $allowed_posts;
}
return $args;
}
开发者ID:USSLomaPrieta,项目名称:usslomaprieta.org,代码行数:27,代码来源:topics.php
示例3: bbPress_submit
public function bbPress_submit()
{
$id = bbp_get_topic_id();
if (empty($id)) {
$id = bbp_get_forum_id();
}
$this->comments->Comment_form_action($id);
}
开发者ID:DenisMalofeyev,项目名称:browserid-wordpress,代码行数:8,代码来源:browserid-bbpress.php
示例4: bbps_hide_forum_meta
function bbps_hide_forum_meta($retval, $forum_id = 0)
{
if (bbps_is_premium_forum(bbp_get_forum_id()) == false || current_user_can('administrator') || current_user_can('bbp_moderator')) {
return $retval;
} else {
return $retval = '-';
}
}
开发者ID:styledthemes,项目名称:bbPress-Support-Forums,代码行数:8,代码来源:bbps-premium-forum.php
示例5: widget
/**
* Displays the output, the forum list
*
* @since bbPress (r2653)
*
* @param mixed $args Arguments
* @param array $instance Instance
* @uses apply_filters() Calls 'bbp_forum_widget_title' with the title
* @uses get_option() To get the forums per page option
* @uses current_user_can() To check if the current user can read
* private() To resety name
* @uses bbp_has_forums() The main forum loop
* @uses bbp_forums() To check whether there are more forums available
* in the loop
* @uses bbp_the_forum() Loads up the current forum in the loop
* @uses bbp_forum_permalink() To display the forum permalink
* @uses bbp_forum_title() To display the forum title
*/
public function widget($args, $instance)
{
extract($args);
$title = apply_filters('bbp_forum_widget_title', $instance['title']);
$parent_forum = !empty($instance['parent_forum']) ? $instance['parent_forum'] : '0';
// Note: private and hidden forums will be excluded via the
// bbp_pre_get_posts_exclude_forums filter and function.
$widget_query = new WP_Query(array('post_parent' => $parent_forum, 'post_type' => bbp_get_forum_post_type(), 'posts_per_page' => get_option('_bbp_forums_per_page', 50), 'orderby' => 'menu_order', 'order' => 'ASC'));
if ($widget_query->have_posts()) {
echo $before_widget;
echo $before_title . $title . $after_title;
$current_forum_id = bbp_get_forum_id();
?>
<ul>
<?php
while ($widget_query->have_posts()) {
$widget_query->the_post();
?>
<?php
$current = $widget_query->post->ID == $current_forum_id ? 'current' : '';
?>
<li>
<a class="bbp-forum-title <?php
echo $current;
?>
" href="<?php
bbp_forum_permalink($widget_query->post->ID);
?>
" title="<?php
bbp_forum_title($widget_query->post->ID);
?>
">
<?php
bbp_forum_title($widget_query->post->ID);
?>
</a>
<span class="topic-count"><?php
bbp_forum_topic_count($widget_query->post->ID);
?>
</span>
</li>
<?php
}
?>
</ul>
<?php
echo $after_widget;
// Reset the $post global
wp_reset_postdata();
}
}
开发者ID:CloouCom,项目名称:Supportte,代码行数:76,代码来源:forum-categories.php
示例6: get_envato_item_ids
public function get_envato_item_ids()
{
$item_ids = 0;
if (function_exists('bbp_get_forum_id')) {
$forum_id = bbp_get_forum_id();
$item_ids = get_post_meta($forum_id, '_ss_envato_items', true);
}
return $item_ids;
}
开发者ID:seriusokhatsky,项目名称:envato-api,代码行数:9,代码来源:class-purchase-repo.php
示例7: add_forum_dependency
/**
* Sidebars to be displayed with forums will also
* be dislpayed with respective topics and replies
*
* @since 1.0
* @param string $where
* @return string
*/
public function add_forum_dependency($where)
{
if (is_singular(array('topic', 'reply'))) {
$data = array(get_post_type(), get_the_ID(), 'forum');
if (function_exists('bbp_get_forum_id')) {
$data[] = bbp_get_forum_id();
}
$where = "(post_type.meta_value IS NULL OR post_type.meta_value IN('" . implode("','", $data) . "'))";
}
return $where;
}
开发者ID:thibaultvanc,项目名称:plombier,代码行数:19,代码来源:bbpress.php
示例8: d4p_is_bbpress
/**
* Check if the current page is forum, topic or other bbPress page.
*
* @return bool true if the current page is the forum related
*/
function d4p_is_bbpress()
{
$is = false;
if (function_exists("bbp_get_forum_id")) {
$is = bbp_get_forum_id() > 0 || bbp_get_reply_id() > 0 || bbp_get_topic_id() > 0;
if (!$is) {
global $template;
$templates = array("single-reply-edit.php", "single-topic-edit.php");
$file = pathinfo($template, PATHINFO_BASENAME);
$is = in_array($file, $templates);
}
}
return apply_filters('d4p_is_bbpress', $is);
}
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:19,代码来源:shared.php
示例9: notify_on_reply
/**
* Send a notification to subscribers
*
* @wp-filter bbp_new_reply 1
*/
public function notify_on_reply($reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = false, $reply_author = 0)
{
if ($this->handler === null) {
return false;
}
global $wpdb;
if (!bbp_is_subscriptions_active()) {
return false;
}
$reply_id = bbp_get_reply_id($reply_id);
$topic_id = bbp_get_topic_id($topic_id);
$forum_id = bbp_get_forum_id($forum_id);
if (!bbp_is_reply_published($reply_id)) {
return false;
}
if (!bbp_is_topic_published($topic_id)) {
return false;
}
$user_ids = bbp_get_topic_subscribers($topic_id, true);
if (empty($user_ids)) {
return false;
}
// Poster name
$reply_author_name = apply_filters('bbsub_reply_author_name', bbp_get_reply_author_display_name($reply_id));
do_action('bbp_pre_notify_subscribers', $reply_id, $topic_id, $user_ids);
// Don't send notifications to the person who made the post
$send_to_author = Falcon::get_option('bbsub_send_to_author', false);
if (!$send_to_author && !empty($reply_author)) {
$user_ids = array_filter($user_ids, function ($id) use($reply_author) {
return (int) $id !== (int) $reply_author;
});
}
// Get userdata for all users
$user_ids = array_map(function ($id) {
return get_userdata($id);
}, $user_ids);
// Sanitize the HTML into text
$content = apply_filters('bbsub_html_to_text', bbp_get_reply_content($reply_id));
// Build email
$text = "%1\$s\n\n";
$text .= "---\nReply to this email directly or view it online:\n%2\$s\n\n";
$text .= "You are receiving this email because you subscribed to it. Login and visit the topic to unsubscribe from these emails.";
$text = sprintf($text, $content, bbp_get_reply_url($reply_id));
$text = apply_filters('bbsub_email_message', $text, $reply_id, $topic_id, $content);
$subject = apply_filters('bbsub_email_subject', 'Re: [' . get_option('blogname') . '] ' . bbp_get_topic_title($topic_id), $reply_id, $topic_id);
$options = array('id' => $topic_id, 'author' => $reply_author_name);
$this->handler->send_mail($user_ids, $subject, $text, $options);
do_action('bbp_post_notify_subscribers', $reply_id, $topic_id, $user_ids);
return true;
}
开发者ID:rmccue,项目名称:Falcon,代码行数:55,代码来源:bbPress.php
示例10: gpbbp_new_post
function gpbbp_new_post($post_id, $post, $update)
{
$TOPIC_POST_TYPE = bbp_get_topic_post_type();
$REPLY_POST_TYPE = bbp_get_reply_post_type();
$post_type = get_post_type($post);
$forum_id = NULL;
if ($post_type == $TOPIC_POST_TYPE) {
$forum_id = wp_get_post_parent_id($post_id);
gpbbp_apply_capabilities_from_forum($post_id, $forum_id);
}
if ($post_type == $REPLY_POST_TYPE) {
$forum_id = bbp_get_forum_id();
gpbbp_apply_capabilities_from_forum($post_id, $forum_id);
}
gpbbp_new_post_notification($post_id, $post, $post_type);
}
开发者ID:petercorlettwiley,项目名称:bbPress-Groups-Sync-Plugin,代码行数:16,代码来源:gp-bbpress-groups.php
示例11: check_forum
public function check_forum()
{
// check forum page
if (!$this->options->get('redirect')) {
return;
}
$forum_id = bbp_get_forum_id();
if (!empty($forum_id) && !$this->user->can_create_topic()) {
$verify_page_id = ss_get_verify_page_id();
$verify_page = get_permalink($verify_page_id);
$login_page = wp_login_url();
if (!$this->user->is_logged()) {
wp_redirect($login_page);
die;
}
wp_redirect($verify_page);
die;
}
}
开发者ID:seriusokhatsky,项目名称:envato-api,代码行数:19,代码来源:class-bbpress.php
示例12: bbp_get_topic_write_url
function bbp_get_topic_write_url($forum_id = 0)
{
global $wp_rewrite;
$bbp = bbpress();
$forum = bbp_get_forum(bbp_get_forum_id($forum_id));
if (empty($forum)) {
return;
}
// Remove view=all link from edit
$forum_link = bbp_get_forum_permalink($forum_id);
// Pretty permalinks
if ($wp_rewrite->using_permalinks()) {
$url = trailingslashit($forum_link) . $bbp->write_id;
$url = trailingslashit($url);
// Unpretty permalinks
} else {
$url = add_query_arg(array(bbp_get_forum_post_type() => $forum->post_name, $bbp->write_id => '1'), $forum_link);
}
return apply_filters('bbp_get_topic_write_url', $url, $forum_id);
}
开发者ID:082net,项目名称:bbpresskr,代码行数:20,代码来源:functions.php
示例13: user_has_cap
static function user_has_cap($allcaps, $caps, $args, $user)
{
static $doing = false;
// bypass if non-bbpress contents and avoid infinite loop
if ($doing === true || !did_action('wp') || !is_bbpress()) {
return $allcaps;
}
$bbp_allcaps = bbp_get_caps_for_role(bbp_get_keymaster_role());
$check_caps = array_intersect(array_values($caps), array_keys($bbp_allcaps));
if (!$check_caps && in_array('upload_files', $caps)) {
$check_caps = array('upload_files');
}
// bypass non bbpress caps
if (!$check_caps || in_array('keep_gate', $check_caps)) {
return $allcaps;
}
$doing = true;
if (!($forum_id = bbp_get_forum_id())) {
$doing = false;
return $allcaps;
}
// Give all modorator capabilities to optional forum moderators per forum
$moderators = bbpresskr()->forum_option('moderators', $forum_id);
if (in_array($user->ID, $moderators) && ($new_caps = bbp_get_caps_for_role(bbp_get_moderator_role()))) {
// remove all bbpress capabilities and append for asigned role only
$_allcaps = array_diff_assoc($allcaps, $bbp_allcaps);
$allcaps = array_merge($_allcaps, $new_caps);
$allcaps['upload_files'] = true;
}
// In case we use usermeta for forum moderator setting
/*$metakey = "forum_role_{$forum_id}";
// Dobule check forum role still exists. Role may excluded by plugin or updates.
if ( isset( $user->$metakey ) && ($new_caps = bbp_get_caps_for_role( $user->$metakey )) ) {
// remove all bbpress capabilities and append for asigned role only
$_allcaps = array_diff_assoc( $allcaps, $bbp_allcaps );
$allcaps = array_merge( $_allcaps, $new_caps );
$allcaps['upload_files'] = true;
}*/
$doing = false;
return $allcaps;
}
开发者ID:082net,项目名称:bbpresskr,代码行数:41,代码来源:roles.php
示例14: private_groups_get_permitted_subforums
/**
* This function filters the list of sub-forums based on the the users group
*/
function private_groups_get_permitted_subforums($sub_forums = '')
{
//this code is from includes/forums/template bbp_forum_get_subforums and sets up which forums to look in based on user capabilities
// Use passed integer as post_parent
if (is_numeric($args)) {
$args = array('post_parent' => $args);
}
// Setup possible post__not_in array
$post_stati[] = bbp_get_public_status_id();
// Super admin get whitelisted post statuses
if (bbp_is_user_keymaster()) {
$post_stati = array(bbp_get_public_status_id(), bbp_get_private_status_id(), bbp_get_hidden_status_id());
// Not a keymaster, so check caps
} else {
// Check if user can read private forums
if (current_user_can('read_private_forums')) {
$post_stati[] = bbp_get_private_status_id();
}
// Check if user can read hidden forums
if (current_user_can('read_hidden_forums')) {
$post_stati[] = bbp_get_hidden_status_id();
}
}
// Parse arguments against default values
$r = bbp_parse_args($args, array('post_parent' => 0, 'post_type' => bbp_get_forum_post_type(), 'post_status' => implode(',', $post_stati), 'posts_per_page' => get_option('_bbp_forums_per_page', 50), 'orderby' => 'menu_order title', 'order' => 'ASC', 'ignore_sticky_posts' => true, 'no_found_rows' => true), 'forum_get_subforums');
$r['post_parent'] = bbp_get_forum_id($r['post_parent']);
// Create a new query for the subforums
$get_posts = new WP_Query();
// No forum passed
$sub_forums = !empty($r['post_parent']) ? $get_posts->query($r) : array();
global $rpg_settingsf;
//if make forums visible set, then show all public forums
if ($rpg_settingsf['set_forum_visibility']) {
return (array) apply_filters('pg_forum_get_subforums', $sub_forums, $r);
}
//Otherwise now we filter this list to exclude those that the user can't see either because not logged in, or forum does not allowed this group
$filtered_sub_forums = private_groups_get_permitted_forums($sub_forums);
return (array) apply_filters('pg_forum_get_subforums', $filtered_sub_forums, $r);
//}
}
开发者ID:USSLomaPrieta,项目名称:usslomaprieta.org,代码行数:43,代码来源:forum-filters.php
示例15: tehnik_bpp_get_forum_id_from_post_id
function tehnik_bpp_get_forum_id_from_post_id($post_id, $post_type)
{
$forum_id = 0;
// Check post type
switch ($post_type) {
// Forum
case bbp_get_forum_post_type():
$forum_id = bbp_get_forum_id($post_id);
break;
// Topic
// Topic
case bbp_get_topic_post_type():
$forum_id = bbp_get_topic_forum_id($post_id);
break;
// Reply
// Reply
case bbp_get_reply_post_type():
$forum_id = bbp_get_reply_forum_id($post_id);
break;
}
return $forum_id;
}
开发者ID:dnaleor,项目名称:Tehnik-bbPress-Permissions,代码行数:22,代码来源:tehnik_bpp_core.php
示例16: tehnik_bpp_filter_forums_by_permissions
/**
* This function filters the list of forums based on the users rank as set by the Mebmers plugin
*/
function tehnik_bpp_filter_forums_by_permissions($args = '')
{
$bbp = bbpress();
// Setup possible post__not_in array
$post_stati[] = bbp_get_public_status_id();
// Check if user can read private forums
if (current_user_can('read_private_forums')) {
$post_stati[] = bbp_get_private_status_id();
}
// Check if user can read hidden forums
if (current_user_can('read_hidden_forums')) {
$post_stati[] = bbp_get_hidden_status_id();
}
// The default forum query for most circumstances
$meta_query = array('post_type' => bbp_get_forum_post_type(), 'post_parent' => bbp_is_forum_archive() ? 0 : bbp_get_forum_id(), 'post_status' => implode(',', $post_stati), 'posts_per_page' => get_option('_bbp_forums_per_page', 50), 'orderby' => 'menu_order', 'order' => 'ASC');
//Get an array of IDs which the current user has permissions to view
$allowed_forums = tehnik_bpp_get_permitted_post_ids(new WP_Query($meta_query));
// The default forum query with allowed forum ids array added
$meta_query['post__in'] = $allowed_forums;
$bbp_f = bbp_parse_args($args, $meta_query, 'has_forums');
// Run the query
$bbp->forum_query = new WP_Query($bbp_f);
return apply_filters('bpp_filter_forums_by_permissions', $bbp->forum_query->have_posts(), $bbp->forum_query);
}
开发者ID:dnaleor,项目名称:Tehnik-bbPress-Permissions,代码行数:27,代码来源:tehnik_bpp_forum.php
示例17: change_freshness_forum
/**
* this function changes the bbp freshness data (time since) into a last post date for forums
* @return string Formatted date-time
*/
function change_freshness_forum()
{
// Verify forum and get last active meta
$forum_id = bbp_get_forum_id($forum_id);
$last_active = get_post_meta($forum_id, '_bbp_last_active_time', true);
if (empty($last_active)) {
$reply_id = bbp_get_forum_last_reply_id($forum_id);
if (!empty($reply_id)) {
$last_active = get_post_field('post_date', $reply_id);
} else {
$topic_id = bbp_get_forum_last_topic_id($forum_id);
if (!empty($topic_id)) {
$last_active = bbp_get_topic_last_active_time($topic_id);
}
}
}
$last_active = bbp_convert_date($last_active);
$date_format = get_option('date_format');
$time_format = get_option('time_format');
$date = date_i18n("{$date_format}", $last_active);
$time = date_i18n("{$time_format}", $last_active);
$active_time = sprintf(_x('%1$s, %2$s', 'date at time', 'bbp-last-post'), $date, $time);
return $active_time;
}
开发者ID:dmitry-korolev,项目名称:arreat,代码行数:28,代码来源:functions-bbpress.php
示例18: bbp_update_reply_forum_id
/**
* Update the reply with its forum id it is in
*
* @since bbPress (r2855)
*
* @param int $reply_id Optional. Reply id to update
* @param int $forum_id Optional. Forum id
* @uses bbp_get_reply_id() To get the reply id
* @uses bbp_get_forum_id() To get the forum id
* @uses get_post_ancestors() To get the reply's forum
* @uses get_post_field() To get the post type of the post
* @uses update_post_meta() To update the reply forum id meta
* @uses apply_filters() Calls 'bbp_update_reply_forum_id' with the forum id
* and reply id
* @return bool Reply's forum id
*/
function bbp_update_reply_forum_id($reply_id = 0, $forum_id = 0)
{
// Validation
$reply_id = bbp_get_reply_id($reply_id);
$forum_id = bbp_get_forum_id($forum_id);
// If no forum_id was passed, walk up ancestors and look for forum type
if (empty($forum_id)) {
// Get ancestors
$ancestors = (array) get_post_ancestors($reply_id);
// Loop through ancestors
if (!empty($ancestors)) {
foreach ($ancestors as $ancestor) {
// Get first parent that is a forum
if (get_post_field('post_type', $ancestor) === bbp_get_forum_post_type()) {
$forum_id = $ancestor;
// Found a forum, so exit the loop and continue
continue;
}
}
}
}
// Update the forum ID
bbp_update_forum_id($reply_id, $forum_id);
return apply_filters('bbp_update_reply_forum_id', (int) $forum_id, $reply_id);
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:41,代码来源:functions.php
示例19: bbp_template_include_theme_compat
/**
* Reset main query vars and filter 'the_content' to output a bbPress
* template part as needed.
*
* @since bbPress (r3032)
* @param string $template
* @uses bbp_is_single_user() To check if page is single user
* @uses bbp_get_single_user_template() To get user template
* @uses bbp_is_single_user_edit() To check if page is single user edit
* @uses bbp_get_single_user_edit_template() To get user edit template
* @uses bbp_is_single_view() To check if page is single view
* @uses bbp_get_single_view_template() To get view template
* @uses bbp_is_forum_edit() To check if page is forum edit
* @uses bbp_get_forum_edit_template() To get forum edit template
* @uses bbp_is_topic_merge() To check if page is topic merge
* @uses bbp_get_topic_merge_template() To get topic merge template
* @uses bbp_is_topic_split() To check if page is topic split
* @uses bbp_get_topic_split_template() To get topic split template
* @uses bbp_is_topic_edit() To check if page is topic edit
* @uses bbp_get_topic_edit_template() To get topic edit template
* @uses bbp_is_reply_edit() To check if page is reply edit
* @uses bbp_get_reply_edit_template() To get reply edit template
* @uses bbp_set_theme_compat_template() To set the global theme compat template
*/
function bbp_template_include_theme_compat($template = '')
{
// Bail if the template already matches a bbPress template. This includes
// archive-* and single-* WordPress post_type matches (allowing
// themes to use the expected format) as well as all bbPress-specific
// template files for users, topics, forums, etc...
if (!empty(bbpress()->theme_compat->bbpress_template)) {
return $template;
}
/** Users *************************************************************/
if (bbp_is_single_user_edit() || bbp_is_single_user()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => '', 'post_title' => esc_attr(bbp_get_displayed_user_field('display_name')), 'post_status' => bbp_get_public_status_id(), 'is_archive' => false, 'comment_status' => 'closed'));
/** Forums ************************************************************/
// Forum archive
} elseif (bbp_is_forum_archive()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bbp_get_forum_archive_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => bbp_get_forum_post_type(), 'post_status' => bbp_get_public_status_id(), 'is_archive' => true, 'comment_status' => 'closed'));
// Single Forum
} elseif (bbp_is_forum_edit() || bbp_is_single_forum()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => bbp_get_forum_id(), 'post_title' => bbp_get_forum_title(), 'post_author' => bbp_get_forum_author_id(), 'post_date' => 0, 'post_content' => get_post_field('post_content', bbp_get_forum_id()), 'post_type' => bbp_get_forum_post_type(), 'post_status' => bbp_get_forum_visibility(), 'is_single' => true, 'comment_status' => 'closed'));
/** Topics ************************************************************/
// Topic archive
} elseif (bbp_is_topic_archive()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bbp_get_topic_archive_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => bbp_get_topic_post_type(), 'post_status' => bbp_get_public_status_id(), 'is_archive' => true, 'comment_status' => 'closed'));
// Single Topic
} elseif (bbp_is_topic_edit() || bbp_is_single_topic()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => bbp_get_topic_id(), 'post_title' => bbp_get_topic_title(), 'post_author' => bbp_get_topic_author_id(), 'post_date' => 0, 'post_content' => get_post_field('post_content', bbp_get_topic_id()), 'post_type' => bbp_get_topic_post_type(), 'post_status' => bbp_get_topic_status(), 'is_single' => true, 'comment_status' => 'closed'));
/** Replies ***********************************************************/
// Reply archive
} elseif (is_post_type_archive(bbp_get_reply_post_type())) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => __('Replies', 'bbpress'), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => bbp_get_reply_post_type(), 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed'));
// Single Reply
} elseif (bbp_is_reply_edit() || bbp_is_single_reply()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => bbp_get_reply_id(), 'post_title' => bbp_get_reply_title(), 'post_author' => bbp_get_reply_author_id(), 'post_date' => 0, 'post_content' => get_post_field('post_content', bbp_get_reply_id()), 'post_type' => bbp_get_reply_post_type(), 'post_status' => bbp_get_reply_status(), 'comment_status' => 'closed'));
/** Views *************************************************************/
} elseif (bbp_is_single_view()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bbp_get_view_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => '', 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed'));
/** Topic Tags ********************************************************/
// Topic Tag Edit
} elseif (bbp_is_topic_tag_edit() || bbp_is_topic_tag()) {
// Stash the current term in a new var
set_query_var('bbp_topic_tag', get_query_var('term'));
// Reset the post with our new title
bbp_theme_compat_reset_post(array('ID' => 0, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => '', 'post_title' => sprintf(__('Topic Tag: %s', 'bbpress'), '<span>' . bbp_get_topic_tag_name() . '</span>'), 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed'));
}
/**
* If we are relying on bbPress's built in theme compatibility to load
* the proper content, we need to intercept the_content, replace the
* output, and display ours instead.
*
* To do this, we first remove all filters from 'the_content' and hook
* our own function into it, which runs a series of checks to determine
* the context, and then uses the built in shortcodes to output the
* correct results from inside an output buffer.
*
* Uses bbp_get_theme_compat_templates() to provide fall-backs that
* should be coded without superfluous mark-up and logic (prev/next
* navigation, comments, date/time, etc...)
*
* Hook into the 'bbp_get_bbpress_template' to override the array of
* possible templates, or 'bbp_bbpress_template' to override the result.
*/
if (bbp_is_theme_compat_active()) {
// Remove all filters from the_content
bbp_remove_all_filters('the_content');
// Add a filter on the_content late, which we will later remove
add_filter('the_content', 'bbp_replace_the_content');
// Find the appropriate template file
$template = bbp_get_theme_compat_templates();
//.........这里部分代码省略.........
开发者ID:hscale,项目名称:webento,代码行数:101,代码来源:theme-compat.php
示例20: is_hidden_from_visitors
public function is_hidden_from_visitors($forum_id = 0)
{
$forum_id = $forum_id == 0 ? bbp_get_forum_id() : $forum_id;
$value = $this->o['hide_from_visitors'];
$meta = get_post_meta($forum_id, '_gdbbatt_settings', true);
if (is_array($meta) && $meta['to_override'] == 1) {
$value = $meta['hide_from_visitors'];
}
return apply_filters('d4p_bbpressattchment_is_hidden_from_visitors', $value == 1);
}
开发者ID:alvarpoon,项目名称:anbig,代码行数:10,代码来源:class.php
注:本文中的bbp_get_forum_id函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论