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


PHP bbp_is_user_keymaster函数代码示例

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


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

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

示例2: pg_get_user_replies_created

function pg_get_user_replies_created($user_id = 0)
{
    // Validate user
    $user_id2 = bbp_get_user_id($user_id);
    $current_user = wp_get_current_user()->ID;
    if (empty($user_id)) {
        return false;
    }
    if (bbp_is_user_keymaster()) {
        $limit = 'n';
    }
    if (user_can($current_user, 'moderate')) {
        $check = get_user_meta($current_user, 'private_group', true);
        if ($check == '') {
            $limit = 'n';
        }
    }
    if ($limit != 'n') {
        global $wpdb;
        $reply = bbp_get_reply_post_type();
        $post_ids = $wpdb->get_col("select ID from {$wpdb->posts} where post_type = '{$reply}'");
        //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_reply_ids($post_ids);
    }
    // The default reply query with allowed topic and reply ids array added
    // Try to get the topics
    $query = bbp_has_replies(array('post_type' => bbp_get_reply_post_type(), 'order' => 'DESC', 'author' => $user_id2, 'post__in' => $allowed_posts));
    return apply_filters('pg_get_user_replies_created', $query, $user_id);
}
开发者ID:USSLomaPrieta,项目名称:usslomaprieta.org,代码行数:29,代码来源:replies.php

示例3: wp_init

 static function wp_init()
 {
     if (bbp_is_user_keymaster()) {
         return;
     }
     add_filter('bbp_allow_anonymous', array(__CLASS__, 'allow_anonymous'));
     add_filter('bbp_current_user_can_publish_replies', array(__CLASS__, 'publish_replies'));
     add_filter('bbp_current_user_can_access_create_reply_form', array(__CLASS__, 'publish_replies'));
     add_filter('bbp_current_user_can_publish_topics', array(__CLASS__, 'publish_topics'));
     add_filter('bbp_current_user_can_access_create_topic_form', array(__CLASS__, 'publish_topics'));
     add_filter('bbp_before_user_can_view_forum_parse_args', array(__CLASS__, 'view_forum_args'));
     add_filter('bbp_user_can_view_forum', array(__CLASS__, 'view_forum'), 10, 3);
     add_filter('bbp_is_forum_private', array(__CLASS__, 'bbp_is_forum_private'), 10, 3);
     add_filter('bbp_template_include_theme_compat', array(__CLASS__, 'template_no_access'));
     // 업로드 권한 체크는 Attachments 에서(attachments.php)
     // add_action( 'pre_get_posts', array( __CLASS__, 'include_private_forums' ), 5 );
 }
开发者ID:082net,项目名称:bbpresskr,代码行数:17,代码来源:permissions.php

示例4: tehnik_bpp_enforce_permissions

/**
 * Check if the user is allowed to view the content (forum/topic/post)
 * Show a 404 error if the user does not have a permission to access the content
 */
function tehnik_bpp_enforce_permissions()
{
    // Bail if not viewing a bbPress item
    if (!is_bbpress()) {
        return;
    }
    // Bail if not viewing a single item or if user has caps
    if (!is_singular() || bbp_is_user_keymaster() || current_user_can('read_hidden_forums')) {
        return;
    }
    if (!tehnik_bpp_can_user_view_post()) {
        if (!is_user_logged_in()) {
            auth_redirect();
        } else {
            bbp_set_404();
        }
    }
}
开发者ID:dnaleor,项目名称:Tehnik-bbPress-Permissions,代码行数:22,代码来源:tehnik_bpp_forum.php

示例5: private_groups_can_user_view_post

function private_groups_can_user_view_post($user_id, $forum_id = '')
{
    //the $forum_id that needs to be passed to this function is the forum_id that the post belongs to
    /* Assume the user can view the post at this point. */
    $can_view = true;
    /* Get the groups for the forum */
    $groups = get_post_meta($forum_id, '_private_group', false);
    /* If we have groups set for this forum  let's get to work. */
    if (!empty($groups) && is_array($groups)) {
        /**
         * Since specific groups exist let's assume the user can't view the post at 
         * this point.  The rest of this functionality should try to disprove this.
         */
        $can_view = false;
        /* If the user's not logged in, assume it's blocked at this point. */
        if (!is_user_logged_in()) {
            $can_view = false;
        }
        /*Check if user is keymaster*/
        if (bbp_is_user_keymaster()) {
            $can_view = true;
        } else {
            $role = bbp_get_user_role($user_id);
            $check = get_user_meta($user_id, 'private_group', true);
            //if they are a mod, and they have no forum groups set, then they can moderate and see across all forums
            if ($role == 'bbp_moderator' && empty($check)) {
                $can_view = true;
            } else {
                /* Loop through each group and set $can_view to true if the user has this group. */
                $check = get_user_meta($user_id, 'private_group', true);
                foreach ($groups as $group) {
                    if ($check == $group) {
                        $can_view = true;
                    }
                }
            }
        }
    }
    /* Allow developers to overwrite the final return value. */
    return apply_filters('private_groups_can_user_view_post', $can_view, $user_id, $forum_id);
}
开发者ID:USSLomaPrieta,项目名称:usslomaprieta.org,代码行数:41,代码来源:user-view-post.php

示例6: bbp_user_has_profile

/**
 * Does a user have a profile for the current site
 *
 * @since bbPress (r4362)
 *
 * @param int $user_id User ID to check
 * @param int $blog_id Blog ID to check
 *
 * @uses bbp_get_user_id() To verify the user ID
 * @uses get_userdata() To get the user's data
 * @uses bbp_is_user_keymaster() To determine if user can see inactive users
 * @uses bbp_is_user_inactive() To check if user is spammer or deleted
 * @uses apply_filters() To allow override of this functions result
 *
 * @return boolean Whether or not the user has a profile on this blog_id
 */
function bbp_user_has_profile($user_id = 0)
{
    // Assume every user has a profile
    $retval = true;
    // Validate user ID, default to displayed or current user
    $user_id = bbp_get_user_id($user_id, true, true);
    // Try to get this user's data
    $user = get_userdata($user_id);
    // No user found, return false
    if (empty($user)) {
        $retval = false;
        // User is inactive, and current user is not a keymaster
    } elseif (!bbp_is_user_keymaster() && bbp_is_user_inactive($user->ID)) {
        $retval = false;
    }
    // Filter and return
    return (bool) apply_filters('bbp_show_user_profile', $retval, $user_id);
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:34,代码来源:capabilities.php

示例7: add_author_post_date_count_ip

    /**
     * Add post date, author post count and author ip to the author element.
     */
    public function add_author_post_date_count_ip()
    {
        ?>
		<div class="bbp-reply-post-date"><?php 
        bbp_reply_post_date(bbp_get_reply_id());
        ?>
</div>

		<div class="bbps-post-count"><?php 
        printf(__('Post count: %s', 'Avada'), bbp_get_user_reply_count_raw(bbp_get_reply_author_id()) + bbp_get_user_topic_count_raw(bbp_get_reply_author_id()));
        ?>
</div>

		<?php 
        if (bbp_is_user_keymaster()) {
            ?>

			<?php 
            do_action('bbp_theme_before_topic_author_admin_details');
            ?>

			<div class="bbp-reply-ip fusion-reply-id"><?php 
            bbp_author_ip(bbp_get_topic_id());
            ?>
</div>

			<?php 
            do_action('bbp_theme_after_topic_author_admin_details');
            ?>

		<?php 
        }
    }
开发者ID:agiper,项目名称:wordpress,代码行数:36,代码来源:class-avada-layout-bbpress.php

示例8: bbp_check_for_blacklist

/**
 * Checks topics and replies against the discussion blacklist of blocked keys
 *
 * @since 2.0.0 bbPress (r3446)
 *
 * @param array $anonymous_data Anonymous user data
 * @param int $author_id Topic or reply author ID
 * @param string $title The title of the content
 * @param string $content The content being posted
 * @uses bbp_is_user_keymaster() Allow keymasters to bypass blacklist
 * @uses bbp_current_author_ip() To get current user IP address
 * @uses bbp_current_author_ua() To get current user agent
 * @return bool True if test is passed, false if fail
 */
function bbp_check_for_blacklist($anonymous_data = false, $author_id = 0, $title = '', $content = '')
{
    // Allow for blacklist check to be skipped
    if (apply_filters('bbp_bypass_check_for_blacklist', false, $anonymous_data, $author_id, $title, $content)) {
        return true;
    }
    // Bail if keymaster is author
    if (!empty($author_id) && bbp_is_user_keymaster($author_id)) {
        return true;
    }
    /** Blacklist *************************************************************/
    /**
     * Filters the bbPress blacklist keys.
     *
     * @since 2.6.0 bbPress (r6050)
     *
     * @param string $blacklist List of blacklist keys. One per new line.
     */
    $blacklist = apply_filters('bbp_blacklist_keys', trim(get_option('blacklist_keys')));
    // Bail if blacklist is empty
    if (empty($blacklist)) {
        return true;
    }
    /** User Data *************************************************************/
    // Define local variable
    $_post = array();
    // Map anonymous user data
    if (!empty($anonymous_data)) {
        $_post['author'] = $anonymous_data['bbp_anonymous_name'];
        $_post['email'] = $anonymous_data['bbp_anonymous_email'];
        $_post['url'] = $anonymous_data['bbp_anonymous_website'];
        // Map current user data
    } elseif (!empty($author_id)) {
        // Get author data
        $user = get_userdata($author_id);
        // If data exists, map it
        if (!empty($user)) {
            $_post['author'] = $user->display_name;
            $_post['email'] = $user->user_email;
            $_post['url'] = $user->user_url;
        }
    }
    // Current user IP and user agent
    $_post['user_ip'] = bbp_current_author_ip();
    $_post['user_ua'] = bbp_current_author_ua();
    // Post title and content
    $_post['title'] = $title;
    $_post['content'] = $content;
    // Ensure HTML tags are not being used to bypass the blacklist.
    $_post['comment_without_html'] = wp_strip_all_tags($content);
    /** Words *****************************************************************/
    // Get words separated by new lines
    $words = explode("\n", $blacklist);
    // Loop through words
    foreach ((array) $words as $word) {
        // Trim the whitespace from the word
        $word = trim($word);
        // Skip empty lines
        if (empty($word)) {
            continue;
        }
        // Do some escaping magic so that '#' chars in the
        // spam words don't break things:
        $word = preg_quote($word, '#');
        $pattern = "#{$word}#i";
        // Loop through post data
        foreach ($_post as $post_data) {
            // Check each user data for current word
            if (preg_match($pattern, $post_data)) {
                // Post does not pass
                return false;
            }
        }
    }
    // Check passed successfully
    return true;
}
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:91,代码来源:functions.php

示例9: bbp_forum_get_subforums

/**
 * Return subforums of given forum
 *
 * @since bbPress (r2747)
 *
 * @param mixed $args All the arguments supported by {@link WP_Query}
 * @uses bbp_get_forum_id() To get the forum id
 * @uses current_user_can() To check if the current user is capable of
 *                           reading private forums
 * @uses get_posts() To get the subforums
 * @uses apply_filters() Calls 'bbp_forum_get_subforums' with the subforums
 *                        and the args
 * @return mixed false if none, array of subs if yes
 */
function bbp_forum_get_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();
        }
    }
    // 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();
    return (array) apply_filters('bbp_forum_get_subforums', $sub_forums, $r);
}
开发者ID:ReLiFeD,项目名称:irreversible.eu,代码行数:45,代码来源:template.php

示例10: bbp_current_user_can_access_create_reply_form

/**
 * Performs a series of checks to ensure the current user can create replies.
 *
 * @since 2.0.0 bbPress (r3127)
 *
 * @uses bbp_is_user_keymaster()
 * @uses bbp_is_topic_edit()
 * @uses current_user_can()
 * @uses bbp_get_topic_id()
 * @uses bbp_allow_anonymous()
 * @uses is_user_logged_in()
 *
 * @return bool
 */
function bbp_current_user_can_access_create_reply_form()
{
    // Users need to earn access
    $retval = false;
    // Always allow keymasters
    if (bbp_is_user_keymaster()) {
        $retval = true;
        // Looking at a single topic, topic is open, and forum is open
    } elseif ((bbp_is_single_topic() || is_page() || is_single()) && bbp_is_topic_open() && bbp_is_forum_open()) {
        $retval = bbp_current_user_can_publish_replies();
        // User can edit this topic
    } elseif (bbp_is_reply_edit()) {
        $retval = current_user_can('edit_reply', bbp_get_reply_id());
    }
    // Allow access to be filtered
    return (bool) apply_filters('bbp_current_user_can_access_create_reply_form', (bool) $retval);
}
开发者ID:CompositeUK,项目名称:clone.bbPress,代码行数:31,代码来源:template.php

示例11: bbp_admin_reset_handler

/**
 * Handle the processing and feedback of the admin tools page
 *
 * @since 2.0.0 bbPress (r2613)
 *
 * @uses check_admin_referer() To verify the nonce and the referer
 * @uses wp_cache_flush() To flush the cache
 * @uses bbp_get_forum_post_type() To get the forum post type
 * @uses bbp_get_topic_post_type() To get the topic post type
 * @uses bbp_get_reply_post_type() To get the reply post type
 */
function bbp_admin_reset_handler()
{
    // Bail if not resetting
    if (!bbp_is_post_request() || empty($_POST['bbpress-are-you-sure'])) {
        return;
    }
    // Only keymasters can proceed
    if (!bbp_is_user_keymaster()) {
        return;
    }
    check_admin_referer('bbpress-reset');
    // Stores messages
    $messages = array();
    $failed = __('Failed!', 'bbpress');
    $success = __('Success!', 'bbpress');
    // Flush the cache; things are about to get ugly.
    wp_cache_flush();
    /** Posts *****************************************************************/
    // Post types and status
    $fpt = bbp_get_forum_post_type();
    $tpt = bbp_get_topic_post_type();
    $rpt = bbp_get_reply_post_type();
    // Define variables
    $bbp_db = bbp_db();
    $statement = __('Deleting Posts&hellip; %s', 'bbpress');
    $sql_posts = $bbp_db->get_results("SELECT `ID` FROM `{$bbp_db->posts}` WHERE `post_type` IN ('{$fpt}', '{$tpt}', '{$rpt}')", OBJECT_K);
    $sql_delete = "DELETE FROM `{$bbp_db->posts}` WHERE `post_type` IN ('{$fpt}', '{$tpt}', '{$rpt}')";
    $result = is_wp_error($bbp_db->query($sql_delete)) ? $failed : $success;
    $messages[] = sprintf($statement, $result);
    /** Post Meta *************************************************************/
    if (!empty($sql_posts)) {
        $sql_meta = array();
        foreach ($sql_posts as $key => $value) {
            $sql_meta[] = $key;
        }
        $statement = __('Deleting Post Meta&hellip; %s', 'bbpress');
        $sql_meta = implode("', '", $sql_meta);
        $sql_delete = "DELETE FROM `{$bbp_db->postmeta}` WHERE `post_id` IN ('{$sql_meta}');";
        $result = is_wp_error($bbp_db->query($sql_delete)) ? $failed : $success;
        $messages[] = sprintf($statement, $result);
    }
    /** Forum moderators ******************************************************/
    $statement = __('Deleting Forum Moderators&hellip; %s', 'bbpress');
    $sql_delete = "DELETE a,b,c FROM `{$bbp_db->terms}` AS a LEFT JOIN `{$bbp_db->term_taxonomy}` AS c ON a.term_id = c.term_id LEFT JOIN `{$bbp_db->term_relationships}` AS b ON b.term_taxonomy_id = c.term_taxonomy_id WHERE c.taxonomy = 'forum-mod';";
    $result = is_wp_error($bbp_db->query($sql_delete)) ? $failed : $success;
    $messages[] = sprintf($statement, $result);
    /** Topic Tags ************************************************************/
    $statement = __('Deleting Topic Tags&hellip; %s', 'bbpress');
    $sql_delete = "DELETE a,b,c FROM `{$bbp_db->terms}` AS a LEFT JOIN `{$bbp_db->term_taxonomy}` AS c ON a.term_id = c.term_id LEFT JOIN `{$bbp_db->term_relationships}` AS b ON b.term_taxonomy_id = c.term_taxonomy_id WHERE c.taxonomy = 'topic-tag';";
    $result = is_wp_error($bbp_db->query($sql_delete)) ? $failed : $success;
    $messages[] = sprintf($statement, $result);
    /** User ******************************************************************/
    // First, if we're deleting previously imported users, delete them now
    if (!empty($_POST['bbpress-delete-imported-users'])) {
        $sql_users = $bbp_db->get_results("SELECT `user_id` FROM `{$bbp_db->usermeta}` WHERE `meta_key` = '_bbp_user_id'", OBJECT_K);
        if (!empty($sql_users)) {
            $sql_meta = array();
            foreach ($sql_users as $key => $value) {
                $sql_meta[] = $key;
            }
            $statement = __('Deleting User&hellip; %s', 'bbpress');
            $sql_meta = implode("', '", $sql_meta);
            $sql_delete = "DELETE FROM `{$bbp_db->users}` WHERE `ID` IN ('{$sql_meta}');";
            $result = is_wp_error($bbp_db->query($sql_delete)) ? $failed : $success;
            $messages[] = sprintf($statement, $result);
            $statement = __('Deleting User Meta&hellip; %s', 'bbpress');
            $sql_delete = "DELETE FROM `{$bbp_db->usermeta}` WHERE `user_id` IN ('{$sql_meta}');";
            $result = is_wp_error($bbp_db->query($sql_delete)) ? $failed : $success;
            $messages[] = sprintf($statement, $result);
        }
    }
    // Next, if we still have users that were not imported delete that meta data
    $statement = __('Deleting User Meta&hellip; %s', 'bbpress');
    $sql_delete = "DELETE FROM `{$bbp_db->usermeta}` WHERE `meta_key` LIKE '%%_bbp_%%';";
    $result = is_wp_error($bbp_db->query($sql_delete)) ? $failed : $success;
    $messages[] = sprintf($statement, $result);
    /** Converter *************************************************************/
    $statement = __('Deleting Conversion Table&hellip; %s', 'bbpress');
    $table_name = $bbp_db->prefix . 'bbp_converter_translator';
    if ($bbp_db->get_var("SHOW TABLES LIKE '{$table_name}'") === $table_name) {
        $bbp_db->query("DROP TABLE {$table_name}");
        $result = $success;
    } else {
        $result = $failed;
    }
    $messages[] = sprintf($statement, $result);
    /** Options ***************************************************************/
    $statement = __('Deleting Settings&hellip; %s', 'bbpress');
    bbp_delete_options();
//.........这里部分代码省略.........
开发者ID:joeyblake,项目名称:bbpress,代码行数:101,代码来源:tools.php

示例12: form_permissions

 /**
  * Permissions to view the 'New Topic'/'Reply To' form in a BuddyPress group.
  *
  * @since bbPress (r4608)
  *
  * @param bool $retval Are we allowed to view the reply form?
  * @uses bp_is_group() To determine if we're on a group page
  * @uses is_user_logged_in() To determine if a user is logged in.
  * @uses bbp_is_user_keymaster() Is the current user a keymaster?
  * @uses bbp_group_is_member() Is the current user a member of the group?
  * @uses bbp_group_is_user_banned() Is the current user banned from the group?
  *
  * @return bool
  */
 public function form_permissions($retval = false)
 {
     // Bail if not a group
     if (!bp_is_group()) {
         return $retval;
     }
     // Bail if user is not logged in
     if (!is_user_logged_in()) {
         return $retval;
         // Keymasters can always pass go
     } elseif (bbp_is_user_keymaster()) {
         $retval = true;
         // Non-members cannot see forms
     } elseif (!bbp_group_is_member()) {
         $retval = false;
         // Banned users cannot see forms
     } elseif (bbp_group_is_banned()) {
         $retval = false;
     }
     return $retval;
 }
开发者ID:luskyj89,项目名称:mt-wordpress,代码行数:35,代码来源:groups.php

示例13: delete_attachments

 static function delete_attachments()
 {
     if (isset($_GET['bbpkraction'])) {
         $nonce = wp_verify_nonce($_GET['_wpnonce'], 'bbpresskr-attachments');
         if ($nonce) {
             global $user_ID;
             $action = $_GET['bbpkraction'];
             $att_id = $_GET['att_id'];
             $bbp_id = $_GET['bbp_id'];
             $post = get_post($bbp_id);
             $author_ID = $post->post_author;
             $file = get_attached_file($att_id);
             $file = pathinfo($file, PATHINFO_BASENAME);
             $allow = 'no';
             if (bbp_is_user_keymaster()) {
                 $allow = self::$conf['delete_visible_to_admins'];
             } else {
                 if (current_user_can('moderate')) {
                     $allow = self::$conf['delete_visible_to_moderators'];
                 } else {
                     if ($author_ID == $user_ID) {
                         $allow = self::$conf['delete_visible_to_author'];
                     }
                 }
             }
             if ($action == 'delete' && ($allow == 'delete' || $allow == 'both')) {
                 wp_delete_attachment($att_id);
             }
             if ($action == 'detach' && ($allow == 'detach' || $allow == 'both')) {
                 global $wpdb;
                 $wpdb->update($wpdb->posts, array('post_parent' => 0), array('ID' => $att_id));
             }
             self::collect_attachments($post->ID);
         }
         $url = remove_query_arg(array('_wpnonce', 'bbpkraction', 'att_id', 'bbp_id'));
         wp_redirect($url);
         exit;
     }
 }
开发者ID:082net,项目名称:bbpresskr,代码行数:39,代码来源:attachments.php

示例14: private_group_enforce_permissions

function private_group_enforce_permissions()
{
    global $rpg_settingsf;
    // Bail if not viewing a bbPress item
    if (!is_bbpress()) {
        return;
    }
    // Bail if not viewing a single item or if user has caps
    if (!is_singular() || bbp_is_user_keymaster() || current_user_can('read_hidden_forums')) {
        return;
    }
    if (!private_groups_check_can_user_view_post()) {
        if (!is_user_logged_in()) {
            if ($rpg_settingsf['redirect_page2']) {
                $link = $rpg_settingsf['redirect_page2'];
                header("Location: {$link}");
            } else {
                auth_redirect();
            }
        } else {
            if ($rpg_settingsf['redirect_page1']) {
                $link = $rpg_settingsf['redirect_page1'];
                header("Location: {$link}");
            } else {
                bbp_set_404();
            }
        }
    }
}
开发者ID:USSLomaPrieta,项目名称:usslomaprieta.org,代码行数:29,代码来源:functions.php

示例15: pg_forum_dropdown

function pg_forum_dropdown($args = '')
{
    //Get an array of forums which the current user has permissions to view
    global $wpdb;
    $forum = bbp_get_forum_post_type();
    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;
        }
    }
    $post_ids = $wpdb->get_col("select ID from {$wpdb->posts} where post_type = '{$forum}'");
    //check this list against those the user is allowed to see, and create a list of valid ones for the wp_query
    $allowed_posts = private_groups_get_dropdown_forums($post_ids);
    // the above generates a list of allowed forums, and we compare this against the original list to create and 'exclude' list
    $result = array_diff($post_ids, $allowed_posts);
    $args['exclude'] = $result;
    return $args;
}
开发者ID:USSLomaPrieta,项目名称:usslomaprieta.org,代码行数:23,代码来源:forum-filters.php


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