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


PHP bbp_get_private_status_id函数代码示例

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


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

示例1: SavePost

 public static function SavePost($post_id, $post, $update)
 {
     if (wp_is_post_revision($post_id) || $post->post_status != 'publish' || $post->post_type != 'namaste_course') {
         return;
     }
     $meta = get_post_meta($post_id, 'buddypress_id', true);
     if (empty($meta)) {
         $group_id = groups_create_group(array('creator_id' => get_current_user_id(), 'name' => $post->post_title, 'description' => 'Обсуждение курса ' . $post->post_title, 'enable_forum' => 1));
         update_post_meta($post_id, 'buddypress_id', $group_id);
         groups_edit_group_settings($group_id, 1, 'private', 'mods');
         $forum_id = bbp_insert_forum($forum_data = array('post_status' => bbp_get_private_status_id(), 'post_type' => bbp_get_forum_post_type(), 'post_author' => bbp_get_current_user_id(), 'post_content' => 'Обсуждение курса ' . $post->post_title, 'post_title' => $post->post_title), $forum_meta = array());
         bbp_update_group_forum_ids($group_id, (array) $forum_id);
         bbp_update_forum_group_ids($forum_id, (array) $group_id);
     }
     bbp_add_user_forum_subscription(bbp_get_current_user_id(), $forum_id);
     update_post_meta($forum_id, '_forum_course_id', $post_id);
 }
开发者ID:Bnei-Baruch,项目名称:mailchimpNamasteIntegration,代码行数:17,代码来源:CreateGroupAndForumForCourse.php

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

示例3: bbp_is_reply_private

/**
 * Is the reply private?
 *
 * @since 2.6.0 bbPress (r5507)
 *
 * @param int $reply_id Optional. Topic id
 * @uses bbp_get_reply_id() To get the reply id
 * @uses bbp_get_reply_status() To get the reply status
 * @uses apply_filters() Calls 'bbp_is_reply_private' with the reply id
 * @return bool True if private, false if not.
 */
function bbp_is_reply_private($reply_id = 0)
{
    $reply_status = bbp_get_reply_status(bbp_get_reply_id($reply_id)) === bbp_get_private_status_id();
    return (bool) apply_filters('bbp_is_reply_private', (bool) $reply_status, $reply_id);
}
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:16,代码来源:template.php

示例4: bbp_is_forum_private

/**
 * Is the forum private?
 *
 * @since 2.0.0 bbPress (r2746)
 *
 * @param int $forum_id Optional. Forum id
 * @param bool $check_ancestors Check if the ancestors are private
 * @uses bbp_get_forum_id() To get the forum ID
 * @uses bbp_is_forum_visibility() To check the forum visibility ID
 * @return bool True if private, false if not
 */
function bbp_is_forum_private($forum_id = 0, $check_ancestors = true)
{
    // Get the forum ID
    $forum_id = bbp_get_forum_id($forum_id);
    // Check if the forum or one of it's ancestors is private
    $retval = bbp_is_forum_visibility($forum_id, bbp_get_private_status_id(), $check_ancestors, 'OR');
    return (bool) apply_filters('bbp_is_forum_private', (bool) $retval, $forum_id, $check_ancestors);
}
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:19,代码来源:template.php

示例5: create_screen_save

 /**
  * Save the Group Forum data on create
  *
  * @since bbPress (r3465)
  */
 public function create_screen_save()
 {
     check_admin_referer('groups_create_save_' . $this->slug);
     $create_forum = !empty($_POST['bbp-create-group-forum']) ? true : false;
     $forum_id = 0;
     $forum_ids = bbp_get_group_forum_ids(bp_get_new_group_id());
     if (!empty($forum_ids)) {
         $forum_id = (int) is_array($forum_ids) ? $forum_ids[0] : $forum_ids;
     }
     // Create a forum, or not
     switch ($create_forum) {
         case true:
             // Bail if initial content was already created
             if (!empty($forum_id)) {
                 return;
             }
             // Set the default forum status
             switch (bp_get_new_group_status()) {
                 case 'hidden':
                     $status = bbp_get_hidden_status_id();
                     break;
                 case 'private':
                     $status = bbp_get_private_status_id();
                     break;
                 case 'public':
                 default:
                     $status = bbp_get_public_status_id();
                     break;
             }
             // Create the initial forum
             $forum_id = bbp_insert_forum(array('post_parent' => bbp_get_group_forums_root_id(), 'post_title' => bp_get_new_group_name(), 'post_content' => bp_get_new_group_description(), 'post_status' => $status));
             // Run the BP-specific functions for new groups
             $this->new_forum(array('forum_id' => $forum_id));
             break;
         case false:
             // Forum was created but is now being undone
             if (!empty($forum_id)) {
                 wp_delete_post($forum_id, true);
                 groups_delete_groupmeta(bp_get_new_group_id(), 'forum_id');
             }
             break;
     }
 }
开发者ID:hscale,项目名称:webento,代码行数:48,代码来源:bbp-extend-buddypress.php

示例6: bbp_pre_get_posts_normalize_forum_visibility

/**
 * Adjusts forum, topic, and reply queries to exclude items that might be
 * contained inside hidden or private forums that the user does not have the
 * capability to view.
 *
 * Doing it with an action allows us to trap all WP_Query's rather than needing
 * to hardcode this logic into each query. It also protects forum content for
 * plugins that might be doing their own queries.
 *
 * @since bbPress (r3291)
 *
 * @param WP_Query $posts_query
 *
 * @uses apply_filters()
 * @uses bbp_exclude_forum_ids()
 * @uses bbp_get_topic_post_type()
 * @uses bbp_get_reply_post_type()
 * @return WP_Query
 */
function bbp_pre_get_posts_normalize_forum_visibility($posts_query = null)
{
    // Bail if all forums are explicitly allowed
    if (true === apply_filters('bbp_include_all_forums', false, $posts_query)) {
        return;
    }
    // Bail if $posts_query is not an object or of incorrect class
    if (!is_object($posts_query) || !is_a($posts_query, 'WP_Query')) {
        return;
    }
    // Get query post types array .
    $post_types = (array) $posts_query->get('post_type');
    // Forums
    if (bbp_get_forum_post_type() === implode('', $post_types)) {
        // Prevent accidental wp-admin post_row override
        if (is_admin() && isset($_REQUEST['post_status'])) {
            return;
        }
        /** Default ***********************************************************/
        // Get any existing post status
        $post_stati = $posts_query->get('post_status');
        // Default to public status
        if (empty($post_stati)) {
            $post_stati[] = bbp_get_public_status_id();
            // Split the status string
        } elseif (is_string($post_stati)) {
            $post_stati = explode(',', $post_stati);
        }
        /** Private ***********************************************************/
        // Remove bbp_get_private_status_id() if user is not capable
        if (!current_user_can('read_private_forums')) {
            $key = array_search(bbp_get_private_status_id(), $post_stati);
            if (!empty($key)) {
                unset($post_stati[$key]);
            }
            // ...or add it if they are
        } else {
            $post_stati[] = bbp_get_private_status_id();
        }
        /** Hidden ************************************************************/
        // Remove bbp_get_hidden_status_id() if user is not capable
        if (!current_user_can('read_hidden_forums')) {
            $key = array_search(bbp_get_hidden_status_id(), $post_stati);
            if (!empty($key)) {
                unset($post_stati[$key]);
            }
            // ...or add it if they are
        } else {
            $post_stati[] = bbp_get_hidden_status_id();
        }
        // Add the statuses
        $posts_query->set('post_status', array_unique(array_filter($post_stati)));
    }
    // Topics Or Replies
    if (array_intersect(array(bbp_get_topic_post_type(), bbp_get_reply_post_type()), $post_types)) {
        // Get forums to exclude
        $forum_ids = bbp_exclude_forum_ids('meta_query');
        // Bail if no forums to exclude
        if (!array_filter($forum_ids)) {
            return;
        }
        // Get any existing meta queries
        $meta_query = $posts_query->get('meta_query');
        // Add our meta query to existing
        $meta_query[] = $forum_ids;
        // Set the meta_query var
        $posts_query->set('meta_query', $meta_query);
    }
}
开发者ID:jenia-buianov,项目名称:all_my_sites,代码行数:88,代码来源:functions.php

示例7: bbp_has_replies

/**
 * The main reply loop. WordPress makes this easy for us
 *
 * @since bbPress (r2553)
 *
 * @param mixed $args All the arguments supported by {@link WP_Query}
 * @uses bbp_show_lead_topic() Are we showing the topic as a lead?
 * @uses bbp_get_topic_id() To get the topic id
 * @uses bbp_get_reply_post_type() To get the reply post type
 * @uses bbp_get_topic_post_type() To get the topic post type
 * @uses get_option() To get the replies per page option
 * @uses bbp_get_paged() To get the current page value
 * @uses current_user_can() To check if the current user is capable of editing
 *                           others' replies
 * @uses WP_Query To make query and get the replies
 * @uses WP_Rewrite::using_permalinks() To check if the blog is using permalinks
 * @uses get_permalink() To get the permalink
 * @uses add_query_arg() To add custom args to the url
 * @uses apply_filters() Calls 'bbp_replies_pagination' with the pagination args
 * @uses paginate_links() To paginate the links
 * @uses apply_filters() Calls 'bbp_has_replies' with
 *                        bbPres::reply_query::have_posts()
 *                        and bbPres::reply_query
 * @return object Multidimensional array of reply information
 */
function bbp_has_replies($args = '')
{
    global $wp_rewrite;
    /** Defaults **************************************************************/
    // Other defaults
    $default_reply_search = !empty($_REQUEST['rs']) ? $_REQUEST['rs'] : false;
    $default_post_parent = bbp_is_single_topic() ? bbp_get_topic_id() : 'any';
    $default_post_type = bbp_is_single_topic() && bbp_show_lead_topic() ? bbp_get_reply_post_type() : array(bbp_get_topic_post_type(), bbp_get_reply_post_type());
    $default_thread_replies = (bool) (bbp_is_single_topic() && bbp_thread_replies());
    // Default query args
    $default = array('post_type' => $default_post_type, 'post_parent' => $default_post_parent, 'posts_per_page' => bbp_get_replies_per_page(), 'paged' => bbp_get_paged(), 'orderby' => 'date', 'order' => 'ASC', 'hierarchical' => $default_thread_replies, 'ignore_sticky_posts' => true, 's' => $default_reply_search);
    // What are the default allowed statuses (based on user caps)
    if (bbp_get_view_all()) {
        // Default view=all statuses
        $post_statuses = array(bbp_get_public_status_id(), bbp_get_closed_status_id(), bbp_get_spam_status_id(), bbp_get_trash_status_id());
        // Add support for private status
        if (current_user_can('read_private_replies')) {
            $post_statuses[] = bbp_get_private_status_id();
        }
        // Join post statuses together
        $default['post_status'] = implode(',', $post_statuses);
        // Lean on the 'perm' query var value of 'readable' to provide statuses
    } else {
        $default['perm'] = 'readable';
    }
    /** Setup *****************************************************************/
    // Parse arguments against default values
    $r = bbp_parse_args($args, $default, 'has_replies');
    // Set posts_per_page value if replies are threaded
    $replies_per_page = $r['posts_per_page'];
    if (true === $r['hierarchical']) {
        $r['posts_per_page'] = -1;
    }
    // Get bbPress
    $bbp = bbpress();
    // Call the query
    $bbp->reply_query = new WP_Query($r);
    // Add pagination values to query object
    $bbp->reply_query->posts_per_page = $replies_per_page;
    $bbp->reply_query->paged = $r['paged'];
    // Never home, regardless of what parse_query says
    $bbp->reply_query->is_home = false;
    // Reset is_single if single topic
    if (bbp_is_single_topic()) {
        $bbp->reply_query->is_single = true;
    }
    // Only add reply to if query returned results
    if ((int) $bbp->reply_query->found_posts) {
        // Get reply to for each reply
        foreach ($bbp->reply_query->posts as &$post) {
            // Check for reply post type
            if (bbp_get_reply_post_type() === $post->post_type) {
                $reply_to = bbp_get_reply_to($post->ID);
                // Make sure it's a reply to a reply
                if (empty($reply_to) || bbp_get_reply_topic_id($post->ID) === $reply_to) {
                    $reply_to = 0;
                }
                // Add reply_to to the post object so we can walk it later
                $post->reply_to = $reply_to;
            }
        }
    }
    // Only add pagination if query returned results
    if ((int) $bbp->reply_query->found_posts && (int) $bbp->reply_query->posts_per_page) {
        // If pretty permalinks are enabled, make our pagination pretty
        if ($wp_rewrite->using_permalinks()) {
            // User's replies
            if (bbp_is_single_user_replies()) {
                $base = bbp_get_user_replies_created_url(bbp_get_displayed_user_id());
                // Root profile page
            } elseif (bbp_is_single_user()) {
                $base = bbp_get_user_profile_url(bbp_get_displayed_user_id());
                // Page or single post
            } elseif (is_page() || is_single()) {
                $base = get_permalink();
//.........这里部分代码省略.........
开发者ID:danielcoats,项目名称:schoolpress,代码行数:101,代码来源:template.php

示例8: test_bbp_get_all_child_ids

 /**
  * @covers ::bbp_get_all_child_ids
  */
 public function test_bbp_get_all_child_ids()
 {
     $f = $this->factory->forum->create();
     // Test initial forum public child counts
     $count = count(bbp_get_all_child_ids($f, bbp_get_forum_post_type()));
     $this->assertSame(0, $count);
     $count = count(bbp_get_all_child_ids($f, bbp_get_topic_post_type()));
     $this->assertSame(0, $count);
     /* Sub-Forums *********************************************************/
     $this->factory->forum->create_many(3, array('post_parent' => $f));
     $this->factory->forum->create(array('post_parent' => $f, 'post_status' => bbp_get_private_status_id()));
     $count = count(bbp_get_all_child_ids($f, bbp_get_forum_post_type()));
     $this->assertSame(4, $count);
     $this->factory->forum->create_many(2, array('post_parent' => $f));
     $count = count(bbp_get_all_child_ids($f, bbp_get_forum_post_type()));
     $this->assertSame(6, $count);
     /* Topics *************************************************************/
     $t1 = $this->factory->topic->create_many(3, array('post_parent' => $f, 'topic_meta' => array('forum_id' => $f)));
     $this->factory->topic->create(array('post_parent' => $f, 'post_status' => bbp_get_spam_status_id(), 'topic_meta' => array('forum_id' => $f)));
     $count = count(bbp_get_all_child_ids($f, bbp_get_topic_post_type()));
     $this->assertSame(4, $count);
     $this->factory->topic->create_many(2, array('post_parent' => $f, 'topic_meta' => array('forum_id' => $f)));
     $count = count(bbp_get_all_child_ids($f, bbp_get_topic_post_type()));
     $this->assertSame(6, $count);
     $this->factory->topic->create(array('post_parent' => $f, 'post_status' => bbp_get_pending_status_id(), 'topic_meta' => array('forum_id' => $f)));
     $count = count(bbp_get_all_child_ids($f, bbp_get_topic_post_type()));
     $this->assertSame(7, $count);
     /* Replies ************************************************************/
     $this->factory->reply->create_many(3, array('post_parent' => $t1[0], 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t1[0])));
     $this->factory->reply->create(array('post_parent' => $t1[0], 'post_status' => bbp_get_spam_status_id(), 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t1[0])));
     $count = count(bbp_get_all_child_ids($t1[0], bbp_get_reply_post_type()));
     $this->assertSame(4, $count);
     $this->factory->reply->create_many(2, array('post_parent' => $t1[0], 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t1[0])));
     $count = count(bbp_get_all_child_ids($t1[0], bbp_get_reply_post_type()));
     $this->assertSame(6, $count);
     $this->factory->reply->create(array('post_parent' => $t1[0], 'post_status' => bbp_get_pending_status_id(), 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t1[0])));
     $count = count(bbp_get_all_child_ids($t1[0], bbp_get_reply_post_type()));
     $this->assertSame(7, $count);
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:42,代码来源:query.php

示例9: bbp_get_form_forum_visibility_dropdown

/**
 * Return the forum visibility dropdown
 *
 * @since bbPress (r3563)
 *
 * @param int $forum_id The forum id to use
 * @uses bbp_is_topic_edit() To check if it's the topic edit page
 * @uses bbp_get_forum_visibility() To get the forum visibility
 * @uses apply_filters()
 * @return string HTML select list for selecting forum visibility
 */
function bbp_get_form_forum_visibility_dropdown($forum_id = 0)
{
    $forum_id = bbp_get_forum_id($forum_id);
    $forum_attr = apply_filters('bbp_forum_visibilities', array(bbp_get_public_status_id() => __('Public', 'bbpress'), bbp_get_private_status_id() => __('Private', 'bbpress'), bbp_get_hidden_status_id() => __('Hidden', 'bbpress')));
    $visibility_output = '<select name="bbp_forum_visibility" id="bbp_forum_visibility_select">' . "\n";
    foreach ($forum_attr as $value => $label) {
        $visibility_output .= "\t" . '<option value="' . $value . '"' . selected(bbp_get_forum_visibility($forum_id), $value, false) . '>' . esc_html($label) . '</option>' . "\n";
    }
    $visibility_output .= '</select>';
    return apply_filters('bbp_get_form_forum_visibility_dropdown', $visibility_output, $forum_id, $forum_attr);
}
开发者ID:hscale,项目名称:webento,代码行数:22,代码来源:bbp-forum-template.php

示例10: create_screen_save_notab

 public function create_screen_save_notab($group_id = 0)
 {
     // No nonce check, since there's no tab
     // Check for possibly empty group_id
     if (empty($group_id)) {
         $group_id = bp_get_new_group_id();
     }
     // We always set this true, because we always create a forum (the user doesn't get to choose whether they want it or not anymore)
     $create_forum = true;
     //!empty( $_POST['bbp-create-group-forum'] ) ? true : false;
     $forum_id = 0;
     $forum_ids = bbp_get_group_forum_ids($group_id);
     if (!empty($forum_ids)) {
         $forum_id = (int) is_array($forum_ids) ? $forum_ids[0] : $forum_ids;
     }
     // Create a forum, or not
     switch ($create_forum) {
         case true:
             // Bail if initial content was already created
             if (!empty($forum_id)) {
                 return;
             }
             // Set the default forum status
             switch (bp_get_new_group_status()) {
                 case 'hidden':
                     $status = bbp_get_hidden_status_id();
                     break;
                 case 'private':
                     $status = bbp_get_private_status_id();
                     break;
                 case 'public':
                 default:
                     $status = bbp_get_public_status_id();
                     break;
             }
             // Create the initial forum
             $forum_id = bbp_insert_forum(array('post_parent' => bbp_get_group_forums_root_id(), 'post_title' => bp_get_new_group_name(), 'post_content' => bp_get_new_group_description(), 'post_status' => $status));
             // Run the BP-specific functions for new groups
             $this->new_forum(array('forum_id' => $forum_id));
             // Update forum active
             groups_update_groupmeta(bp_get_new_group_id(), '_bbp_forum_enabled_' . $forum_id, true);
             // Toggle forum on
             $this->toggle_group_forum(bp_get_new_group_id(), true);
             break;
         case false:
             // Forum was created but is now being undone
             if (!empty($forum_id)) {
                 // Delete the forum
                 wp_delete_post($forum_id, true);
                 // Delete meta values
                 groups_delete_groupmeta(bp_get_new_group_id(), 'forum_id');
                 groups_delete_groupmeta(bp_get_new_group_id(), '_bbp_forum_enabled_' . $forum_id);
                 // Toggle forum off
                 $this->toggle_group_forum(bp_get_new_group_id(), false);
             }
             break;
     }
 }
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:58,代码来源:groups.php

示例11: bbp_admin_repair_forum_visibility

/**
 * Recaches the private and hidden forums
 *
 * @since bbPress (r4104)
 *
 * @uses delete_option() to delete private and hidden forum pointers
 * @uses WP_Query() To query post IDs
 * @uses is_wp_error() To return if error occurred
 * @uses update_option() To update the private and hidden post ID pointers
 * @return array An array of the status code and the message
 */
function bbp_admin_repair_forum_visibility()
{
    $statement = __('Recalculating forum visibility &hellip; %s', 'bbpress');
    $result = __('Failed!', 'bbpress');
    // First, delete everything.
    delete_option('_bbp_private_forums');
    delete_option('_bbp_hidden_forums');
    // Next, get all the private and hidden forums
    $private_forums = new WP_Query(array('suppress_filters' => true, 'nopaging' => true, 'post_type' => bbp_get_forum_post_type(), 'post_status' => bbp_get_private_status_id(), 'fields' => 'ids'));
    $hidden_forums = new WP_Query(array('suppress_filters' => true, 'nopaging' => true, 'post_type' => bbp_get_forum_post_type(), 'post_status' => bbp_get_hidden_status_id(), 'fields' => 'ids'));
    // Bail if queries returned errors
    if (is_wp_error($private_forums) || is_wp_error($hidden_forums)) {
        return array(2, sprintf($statement, $result));
    }
    update_option('_bbp_private_forums', $private_forums->posts);
    // Private forums
    update_option('_bbp_hidden_forums', $hidden_forums->posts);
    // Hidden forums
    // Complete results
    $result = __('Complete!', 'bbpress');
    return array(0, sprintf($statement, $result));
}
开发者ID:hscale,项目名称:webento,代码行数:33,代码来源:bbp-tools.php

示例12: test_bbp_is_forum_private

 /**
  * @covers ::bbp_is_forum_private
  */
 public function test_bbp_is_forum_private()
 {
     $f = $this->factory->forum->create(array('post_status' => 'private'));
     $forum = bbp_get_forum_visibility($f);
     $this->assertSame('private', $forum);
     $forum_status_id = bbp_get_private_status_id($f);
     $this->assertSame('private', $forum_status_id);
     $this->assertTrue(bbp_is_forum_private($f));
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:12,代码来源:status.php

示例13: row_actions

 /**
  * Forum Row actions
  *
  * Remove the quick-edit action link and display the description under
  * the forum title and add the open/close links
  *
  * @since 2.0.0 bbPress (r2577)
  *
  * @param array $actions Actions
  * @param array $forum Forum object
  * @uses bbp_get_public_status_id() To get the published forum id's
  * @uses bbp_get_private_status_id() To get the private forum id's
  * @uses bbp_get_hidden_status_id() To get the hidden forum id's
  * @uses bbp_get_closed_status_id() To get the closed forum id's
  * @uses wp_nonce_url() To nonce the url
  * @uses bbp_is_forum_open() To check if a forum is open
  * @uses bbp_forum_content() To output forum description
  * @return array $actions Actions
  */
 public function row_actions($actions, $forum)
 {
     if ($this->bail()) {
         return $actions;
     }
     unset($actions['inline hide-if-no-js']);
     // Only show the actions if the user is capable of viewing them :)
     if (current_user_can('keep_gate', $forum->ID)) {
         // Show the 'close' and 'open' link on published, private, hidden and closed posts only
         if (in_array($forum->post_status, array(bbp_get_public_status_id(), bbp_get_private_status_id(), bbp_get_hidden_status_id(), bbp_get_closed_status_id()))) {
             $close_uri = wp_nonce_url(add_query_arg(array('forum_id' => $forum->ID, 'action' => 'bbp_toggle_forum_close'), remove_query_arg(array('bbp_forum_toggle_notice', 'forum_id', 'failed', 'super'))), 'close-forum_' . $forum->ID);
             if (bbp_is_forum_open($forum->ID)) {
                 $actions['closed'] = '<a href="' . esc_url($close_uri) . '" title="' . esc_attr__('Close this forum', 'bbpress') . '">' . _x('Close', 'Close a Forum', 'bbpress') . '</a>';
             } else {
                 $actions['closed'] = '<a href="' . esc_url($close_uri) . '" title="' . esc_attr__('Open this forum', 'bbpress') . '">' . _x('Open', 'Open a Forum', 'bbpress') . '</a>';
             }
         }
     }
     // simple hack to show the forum description under the title
     bbp_forum_content($forum->ID);
     return $actions;
 }
开发者ID:joeyblake,项目名称:bbpress,代码行数:41,代码来源:forums.php

示例14: bbp_list_private_groups_subforums

function bbp_list_private_groups_subforums($args)
{
    // 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();
        }
    }
    $args['post_status'] = implode(',', $post_stati);
    return $args;
}
开发者ID:USSLomaPrieta,项目名称:usslomaprieta.org,代码行数:25,代码来源:forum-filters.php

示例15: include_private_forums

 public static function include_private_forums($posts_query)
 {
     // Bail if $posts_query is not an object or of incorrect class
     if (!is_object($posts_query) || !is_a($posts_query, 'WP_Query')) {
         return;
     }
     // Get query post types array .
     $post_types = (array) $posts_query->get('post_type');
     // Forums
     if (bbp_get_forum_post_type() === implode('', $post_types)) {
         // Prevent accidental wp-admin post_row override
         if (is_admin() && isset($_REQUEST['post_status'])) {
             return;
         }
         /** Default ***********************************************************/
         // Get any existing post status
         $post_stati = (array) $posts_query->get('post_status');
         if (!in_array(bbp_get_private_status_id(), $post_stati)) {
             $post_stati[] = bbp_get_private_status_id();
             // Add the statuses
             $posts_query->set('post_status', array_unique(array_filter($post_stati)));
         }
     }
 }
开发者ID:082net,项目名称:bbpresskr,代码行数:24,代码来源:permissions.php


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