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


PHP bbp_get_forum_id函数代码示例

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


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


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