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


PHP bp_is_user_spammer函数代码示例

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


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

示例1: _e

_e('Capabilities', 'buddypress');
?>
</h3>

				<form action="<?php 
echo bp_displayed_user_domain() . bp_get_settings_slug() . '/capabilities/';
?>
" name="account-capabilities-form" id="account-capabilities-form" class="standard-form" method="post">

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

					<label>
						<input type="checkbox" name="user-spammer" id="user-spammer" value="1" <?php 
checked(bp_is_user_spammer(bp_displayed_user_id()));
?>
 />
						 <?php 
_e('This user is a spammer.', 'buddypress');
?>
					</label>

					<div class="submit">
						<input type="submit" value="<?php 
_e('Save', 'buddypress');
?>
" id="capabilities-submit" name="capabilities-submit" />
					</div>

					<?php 
开发者ID:shads196770,项目名称:cbox-theme,代码行数:31,代码来源:capabilities.php

示例2: wp_idea_stream_buddypress_is_spammy

/**
 * As BuddyPress brings a "spam user" feature to regular configs,
 * let's use it!
 *
 * @since  2.3.0
 *
 * @param  bool    $is_spammer whether the user is a spammer or not
 * @param  WP_User $user       the WordPress User Object
 * @return bool    Whether the user is a spammer or not
 */
function wp_idea_stream_buddypress_is_spammy($is_spammer, $user = null)
{
    if (empty($user->ID)) {
        return $is_spammer;
    }
    return bp_is_user_spammer($user->ID);
}
开发者ID:mrjarbenne,项目名称:wp-idea-stream,代码行数:17,代码来源:functions.php

示例3: bp_is_user_active

/**
 * Checks if user is active
 *
 * @since BuddyPress (1.6)
 *
 * @uses is_user_logged_in() To check if user is logged in
 * @uses bp_loggedin_user_id() To get current user ID
 * @uses bp_is_user_spammer() To check if user is spammer
 * @uses bp_is_user_deleted() To check if user is deleted
 *
 * @param int $user_id The user ID to check
 * @return bool True if public, false if not
 */
function bp_is_user_active($user_id = 0)
{
    // Default to current user
    if (empty($user_id) && is_user_logged_in()) {
        $user_id = bp_loggedin_user_id();
    }
    // No user to check
    if (empty($user_id)) {
        return false;
    }
    // Check spam
    if (bp_is_user_spammer($user_id)) {
        return false;
    }
    // Check deleted
    if (bp_is_user_deleted($user_id)) {
        return false;
    }
    // Assume true if not spam or deleted
    return true;
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:34,代码来源:bp-members-functions.php

示例4: user_admin_status_metabox

        /**
         * Render the Status metabox for user's profile screen.
         *
         * Actions are:
         * - Update profile fields if xProfile component is active
         * - Spam/Unspam user
         *
         * @since 2.0.0
         *
         * @param WP_User|null $user The WP_User object to be edited.
         */
        public function user_admin_status_metabox($user = null)
        {
            // Bail if no user id or if the user has not activated their account yet.
            if (empty($user->ID)) {
                return;
            }
            // Bail if user has not been activated yet (how did you get here?).
            if (isset($user->user_status) && 2 == $user->user_status) {
                ?>

			<p class="not-activated"><?php 
                esc_html_e('User account has not yet been activated', 'buddypress');
                ?>
</p><br/>

			<?php 
                return;
            }
            ?>

		<div class="submitbox" id="submitcomment">
			<div id="minor-publishing">
				<div id="misc-publishing-actions">
					<?php 
            // Get the spam status once here to compare against below.
            $is_spammer = bp_is_user_spammer($user->ID);
            /**
             * In configs where BuddyPress is not network activated,
             * regular admins cannot mark a user as a spammer on front
             * end. This prevent them to do it in backend.
             *
             * Also prevent admins from marking themselves or other
             * admins as spammers.
             */
            if (empty($this->is_self_profile) && !in_array($user->user_login, get_super_admins()) && empty($this->subsite_activated) || !empty($this->subsite_activated) && current_user_can('manage_network_users')) {
                ?>

						<div class="misc-pub-section" id="comment-status-radio">
							<label class="approved"><input type="radio" name="user_status" value="ham" <?php 
                checked($is_spammer, false);
                ?>
><?php 
                esc_html_e('Active', 'buddypress');
                ?>
</label><br />
							<label class="spam"><input type="radio" name="user_status" value="spam" <?php 
                checked($is_spammer, true);
                ?>
><?php 
                esc_html_e('Spammer', 'buddypress');
                ?>
</label>
						</div>

					<?php 
            }
            ?>

					<div class="misc-pub-section curtime misc-pub-section-last">
						<?php 
            // Translators: Publish box date format, see http://php.net/date.
            $datef = __('M j, Y @ G:i', 'buddypress');
            $date = date_i18n($datef, strtotime($user->user_registered));
            ?>
						<span id="timestamp"><?php 
            printf(__('Registered on: %s', 'buddypress'), '<strong>' . $date . '</strong>');
            ?>
</span>
					</div>
				</div> <!-- #misc-publishing-actions -->

				<div class="clear"></div>
			</div><!-- #minor-publishing -->

			<div id="major-publishing-actions">

				<div id="publishing-action">
					<a class="button bp-view-profile" href="<?php 
            echo esc_url(bp_core_get_user_domain($user->ID));
            ?>
" target="_blank"><?php 
            esc_html_e('View Profile', 'buddypress');
            ?>
</a>
					<?php 
            submit_button(esc_html__('Update Profile', 'buddypress'), 'primary', 'save', false);
            ?>
				</div>
				<div class="clear"></div>
//.........这里部分代码省略.........
开发者ID:buddypress,项目名称:BuddyPress-build,代码行数:101,代码来源:class-bp-members-admin.php

示例5: setup_globals

 /**
  * Setup globals
  *
  * The BP_MEMBERS_SLUG constant is deprecated, and only used here for
  * backwards compatibility.
  *
  * @since BuddyPress (1.5)
  */
 public function setup_globals($args = array())
 {
     $bp = buddypress();
     // Define a slug, if necessary
     if (!defined('BP_MEMBERS_SLUG')) {
         define('BP_MEMBERS_SLUG', $this->id);
     }
     $members_globals = array('slug' => BP_MEMBERS_SLUG, 'root_slug' => isset($bp->pages->members->slug) ? $bp->pages->members->slug : BP_MEMBERS_SLUG, 'has_directory' => true, 'directory_title' => _x('Members', 'component directory title', 'buddypress'), 'global_tables' => array('table_name_last_activity' => bp_core_get_table_prefix() . 'bp_activity', 'table_name_signups' => bp_core_get_table_prefix() . 'signups'), 'search_string' => __('Search Members...', 'buddypress'));
     parent::setup_globals($members_globals);
     /** Logged in user ****************************************************/
     // Fetch the full name for the logged in user
     $bp->loggedin_user->fullname = bp_core_get_user_displayname(bp_loggedin_user_id());
     // Hits the DB on single WP installs so get this separately
     $bp->loggedin_user->is_super_admin = $bp->loggedin_user->is_site_admin = is_super_admin(bp_loggedin_user_id());
     // The domain for the user currently logged in. eg: http://domain.com/members/andy
     $bp->loggedin_user->domain = bp_core_get_user_domain(bp_loggedin_user_id());
     // The core userdata of the user who is currently logged in.
     $bp->loggedin_user->userdata = bp_core_get_core_userdata(bp_loggedin_user_id());
     /** Displayed user ****************************************************/
     // The domain for the user currently being displayed
     $bp->displayed_user->domain = bp_core_get_user_domain(bp_displayed_user_id());
     // The core userdata of the user who is currently being displayed
     $bp->displayed_user->userdata = bp_core_get_core_userdata(bp_displayed_user_id());
     // Fetch the full name displayed user
     $bp->displayed_user->fullname = bp_core_get_user_displayname(bp_displayed_user_id());
     /** Signup ***************************************************/
     $bp->signup = new stdClass();
     /** Profiles Fallback *************************************************/
     if (!bp_is_active('xprofile')) {
         $bp->profile = new stdClass();
         $bp->profile->slug = 'profile';
         $bp->profile->id = 'profile';
     }
     /** Default Profile Component *****************************************/
     if (!defined('BP_DEFAULT_COMPONENT')) {
         if (bp_is_active('activity') && isset($bp->pages->activity)) {
             $bp->default_component = bp_get_activity_slug();
         } else {
             $bp->default_component = 'xprofile' === $bp->profile->id ? 'profile' : $bp->profile->id;
         }
     } else {
         $bp->default_component = BP_DEFAULT_COMPONENT;
     }
     if (bp_displayed_user_id()) {
         $bp->canonical_stack['base_url'] = bp_displayed_user_domain();
         if (bp_current_component()) {
             $bp->canonical_stack['component'] = bp_current_component();
         }
         if (bp_current_action()) {
             $bp->canonical_stack['action'] = bp_current_action();
         }
         if (!empty($bp->action_variables)) {
             $bp->canonical_stack['action_variables'] = bp_action_variables();
         }
         if (!bp_current_component()) {
             $bp->current_component = $bp->default_component;
         } else {
             if (bp_is_current_component($bp->default_component) && !bp_current_action()) {
                 // The canonical URL will not contain the default component
                 unset($bp->canonical_stack['component']);
             }
         }
         // if we're on a spammer's profile page, only users with the 'bp_moderate' cap
         // can view subpages on the spammer's profile
         //
         // users without the cap trying to access a spammer's subnav page will get
         // redirected to the root of the spammer's profile page.  this occurs by
         // by removing the component in the canonical stack.
         if (bp_is_user_spammer(bp_displayed_user_id()) && !bp_current_user_can('bp_moderate')) {
             unset($bp->canonical_stack['component']);
         }
     }
 }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:81,代码来源:bp-members-loader.php

示例6: bp_core_is_user_spammer

/**
 * @deprecated 1.6.0
 */
function bp_core_is_user_spammer($user_id = 0)
{
    _deprecated_function(__FUNCTION__, '1.6');
    bp_is_user_spammer($user_id);
}
开发者ID:mawilliamson,项目名称:wordpress,代码行数:8,代码来源:1.6.php

示例7: bp_core_admin_user_row_actions

/**
 * Add "Mark as Spam/Ham" button to user row actions.
 *
 * @since 2.0.0
 *
 * @param array  $actions     User row action links.
 * @param object $user_object Current user information.
 * @return array $actions User row action links.
 */
function bp_core_admin_user_row_actions($actions, $user_object)
{
    // Setup the $user_id variable from the current user object.
    $user_id = 0;
    if (!empty($user_object->ID)) {
        $user_id = absint($user_object->ID);
    }
    // Bail early if user cannot perform this action, or is looking at themselves.
    if (current_user_can('edit_user', $user_id) && bp_loggedin_user_id() !== $user_id) {
        // Admin URL could be single site or network.
        $url = bp_get_admin_url('users.php');
        // If spammed, create unspam link.
        if (bp_is_user_spammer($user_id)) {
            $url = add_query_arg(array('action' => 'ham', 'user' => $user_id), $url);
            $unspam_link = wp_nonce_url($url, 'bp-spam-user');
            $actions['ham'] = sprintf('<a href="%1$s">%2$s</a>', esc_url($unspam_link), esc_html__('Not Spam', 'buddypress'));
            // If not already spammed, create spam link.
        } else {
            $url = add_query_arg(array('action' => 'spam', 'user' => $user_id), $url);
            $spam_link = wp_nonce_url($url, 'bp-spam-user');
            $actions['spam'] = sprintf('<a class="submitdelete" href="%1$s">%2$s</a>', esc_url($spam_link), esc_html__('Spam', 'buddypress'));
        }
    }
    // Create a "View" link.
    $url = bp_core_get_user_domain($user_id);
    $actions['view'] = sprintf('<a href="%1$s">%2$s</a>', esc_url($url), esc_html__('View', 'buddypress'));
    // Return new actions.
    return $actions;
}
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:38,代码来源:bp-core-admin-functions.php

示例8: bp_core_set_uri_globals


//.........这里部分代码省略.........
                unset($matches);
            }
            // Unset uri chunks
            unset($uri_chunks);
        }
    }
    // URLs with BP_ENABLE_ROOT_PROFILES enabled won't be caught above
    if (empty($matches) && bp_core_enable_root_profiles()) {
        // Make sure there's a user corresponding to $bp_uri[0]
        if (!empty($bp->pages->members) && !empty($bp_uri[0]) && ($root_profile = get_user_by('login', $bp_uri[0]))) {
            // Force BP to recognize that this is a members page
            $matches[] = 1;
            $match = $bp->pages->members;
            $match->key = 'members';
            // Without the 'members' URL chunk, WordPress won't know which page to load
            // This filter intercepts the WP query and tells it to load the members page
            add_filter('request', create_function('$query_args', '$query_args["pagename"] = "' . $match->name . '"; return $query_args;'));
        }
    }
    // Search doesn't have an associated page, so we check for it separately
    if (!empty($bp_uri[0]) && bp_get_search_slug() == $bp_uri[0]) {
        $matches[] = 1;
        $match = new stdClass();
        $match->key = 'search';
        $match->slug = bp_get_search_slug();
    }
    // This is not a BuddyPress page, so just return.
    if (!isset($matches)) {
        return false;
    }
    // Find the offset. With $root_profile set, we fudge the offset down so later parsing works
    $slug = !empty($match) ? explode('/', $match->slug) : '';
    $uri_offset = empty($root_profile) ? 0 : -1;
    // Rejig the offset
    if (!empty($slug) && 1 < count($slug)) {
        array_pop($slug);
        $uri_offset = count($slug);
    }
    // Global the unfiltered offset to use in bp_core_load_template().
    // To avoid PHP warnings in bp_core_load_template(), it must always be >= 0
    $bp->unfiltered_uri_offset = $uri_offset >= 0 ? $uri_offset : 0;
    // We have an exact match
    if (isset($match->key)) {
        // Set current component to matched key
        $bp->current_component = $match->key;
        // If members component, do more work to find the actual component
        if ('members' == $match->key) {
            // Viewing a specific user
            if (!empty($bp_uri[$uri_offset + 1])) {
                // Switch the displayed_user based on compatbility mode
                if (bp_is_username_compatibility_mode()) {
                    $bp->displayed_user->id = (int) bp_core_get_userid(urldecode($bp_uri[$uri_offset + 1]));
                } else {
                    $bp->displayed_user->id = (int) bp_core_get_userid_from_nicename(urldecode($bp_uri[$uri_offset + 1]));
                }
                if (!bp_displayed_user_id()) {
                    // Prevent components from loading their templates
                    $bp->current_component = '';
                    bp_do_404();
                    return;
                }
                // If the displayed user is marked as a spammer, 404 (unless logged-
                // in user is a super admin)
                if (bp_displayed_user_id() && bp_is_user_spammer(bp_displayed_user_id())) {
                    if (bp_current_user_can('bp_moderate')) {
                        bp_core_add_message(__('This user has been marked as a spammer. Only site admins can view this profile.', 'buddypress'), 'warning');
                    } else {
                        bp_do_404();
                        return;
                    }
                }
                // Bump the offset
                if (isset($bp_uri[$uri_offset + 2])) {
                    $bp_uri = array_merge(array(), array_slice($bp_uri, $uri_offset + 2));
                    $bp->current_component = $bp_uri[0];
                    // No component, so default will be picked later
                } else {
                    $bp_uri = array_merge(array(), array_slice($bp_uri, $uri_offset + 2));
                    $bp->current_component = '';
                }
                // Reset the offset
                $uri_offset = 0;
            }
        }
    }
    // Set the current action
    $bp->current_action = isset($bp_uri[$uri_offset + 1]) ? $bp_uri[$uri_offset + 1] : '';
    // Slice the rest of the $bp_uri array and reset offset
    $bp_uri = array_slice($bp_uri, $uri_offset + 2);
    $uri_offset = 0;
    // Set the entire URI as the action variables, we will unset the current_component and action in a second
    $bp->action_variables = $bp_uri;
    // Remove the username from action variables if this is not a VHOST install
    // @todo - move or remove this all together
    if (defined('VHOST') && 'no' == VHOST && empty($bp->current_component)) {
        array_shift($bp_uri);
    }
    // Reset the keys by merging with an empty array
    $bp->action_variables = array_merge(array(), $bp->action_variables);
}
开发者ID:newington,项目名称:buddypress,代码行数:101,代码来源:bp-core-catchuri.php

示例9: user_admin_status_metabox

        /**
         * Render the Status metabox for user's profile screen.
         *
         * Actions are:
         * - Update profile fields if xProfile component is active
         * - Spam/Unspam user
         *
         * @access public
         * @since BuddyPress (2.0.0)
         *
         * @param WP_User $user The WP_User object to be edited.
         */
        public function user_admin_status_metabox($user = null)
        {
            // Bail if no user id or if the user has not activated their account yet
            if (empty($user->ID)) {
                return;
            }
            if (isset($user->user_status) && 2 == $user->user_status) {
                echo '<p class="not-activated">' . esc_html__('User account has not yet been activated', 'buddypress') . '</p><br/>';
                return;
            }
            ?>

		<div class="submitbox" id="submitcomment">
			<div id="minor-publishing">
				<div id="misc-publishing-actions">
					<?php 
            /**
             * In configs where BuddyPress is not network activated, regular admins
             * cannot mark a user as a spammer on front end. This prevent them to do
             * it in backend.
             */
            ?>
					<?php 
            if (empty($this->subsite_activated) || !empty($this->subsite_activated) && current_user_can('manage_network_users')) {
                ?>
						<div class="misc-pub-section" id="comment-status-radio">
							<label class="approved"><input type="radio" name="user_status" value="ham" <?php 
                checked(bp_is_user_spammer($user->ID), false);
                ?>
><?php 
                esc_html_e('Active', 'buddypress');
                ?>
</label><br />
							<label class="spam"><input type="radio" name="user_status" value="spam" <?php 
                checked(bp_is_user_spammer($user->ID), true);
                ?>
><?php 
                esc_html_e('Spammer', 'buddypress');
                ?>
</label>
						</div>
					<?php 
            }
            ?>

					<div class="misc-pub-section curtime misc-pub-section-last">
						<?php 
            // translators: Publish box date format, see http://php.net/date
            $datef = __('M j, Y @ G:i', 'buddypress');
            $date = date_i18n($datef, strtotime($user->user_registered));
            ?>
						<span id="timestamp"><?php 
            printf(__('Registered on: <strong>%1$s</strong>', 'buddypress'), $date);
            ?>
</span>
					</div>
				</div> <!-- #misc-publishing-actions -->

				<div class="clear"></div>
			</div><!-- #minor-publishing -->

			<div id="major-publishing-actions">

				<div id="publishing-action">
					<a class="button bp-view-profile" href="<?php 
            echo esc_url(bp_core_get_user_domain($user->ID));
            ?>
" target="_blank"><?php 
            esc_html_e('View Profile', 'buddypress');
            ?>
</a>
					<?php 
            submit_button(esc_html__('Update Profile', 'buddypress'), 'primary', 'save', false, array('tabindex' => '4'));
            ?>
				</div>
				<div class="clear"></div>
			</div><!-- #major-publishing-actions -->

		</div><!-- #submitcomment -->

		<?php 
        }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:94,代码来源:bp-members-admin.php

示例10: bp_members_adminbar_admin_menu

/**
 * Adds an admin bar menu to any profile page providing site moderator actions
 * that allow capable users to clean up a users account.
 *
 * @package BuddyPress XProfile
 * @global $bp BuddyPress
 */
function bp_members_adminbar_admin_menu()
{
    global $bp;
    // Only show if viewing a user
    if (!bp_displayed_user_id()) {
        return false;
    }
    // Don't show this menu to non site admins or if you're viewing your own profile
    if (!current_user_can('edit_users') || bp_is_my_profile()) {
        return false;
    }
    ?>

	<li id="bp-adminbar-adminoptions-menu">

		<a href=""><?php 
    _e('Admin Options', 'buddypress');
    ?>
</a>

		<ul>
			<?php 
    if (bp_is_active('xprofile')) {
        ?>

				<li><a href="<?php 
        bp_members_component_link('profile', 'edit');
        ?>
"><?php 
        printf(__("Edit %s's Profile", 'buddypress'), esc_attr($bp->displayed_user->fullname));
        ?>
</a></li>

			<?php 
    }
    ?>

			<li><a href="<?php 
    bp_members_component_link('profile', 'change-avatar');
    ?>
"><?php 
    printf(__("Edit %s's Avatar", 'buddypress'), esc_attr($bp->displayed_user->fullname));
    ?>
</a></li>

			<?php 
    if (!bp_is_user_spammer(bp_displayed_user_id())) {
        ?>

				<li><a href="<?php 
        echo wp_nonce_url($bp->displayed_user->domain . 'admin/mark-spammer/', 'mark-unmark-spammer');
        ?>
" class="confirm"><?php 
        printf(__("Mark as Spammer", 'buddypress'), esc_attr($bp->displayed_user->fullname));
        ?>
</a></li>

			<?php 
    } else {
        ?>

				<li><a href="<?php 
        echo wp_nonce_url($bp->displayed_user->domain . 'admin/unmark-spammer/', 'mark-unmark-spammer');
        ?>
" class="confirm"><?php 
        _e("Not a Spammer", 'buddypress');
        ?>
</a></li>

			<?php 
    }
    ?>

			<li><a href="<?php 
    echo wp_nonce_url($bp->displayed_user->domain . 'admin/delete-user/', 'delete-user');
    ?>
" class="confirm"><?php 
    printf(__("Delete %s's Account", 'buddypress'), esc_attr($bp->displayed_user->fullname));
    ?>
</a></li>

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

		</ul>
	</li>

	<?php 
}
开发者ID:newington,项目名称:buddypress,代码行数:97,代码来源:bp-members-buddybar.php

示例11: bp_core_admin_user_row_actions

/**
 * Add "Mark as Spam/Ham" button to user row actions.
 *
 * @since BuddyPress (2.0.0)
 *
 * @param array $actions User row action links.
 * @param object $user_object Current user information.
 * @return array $actions User row action links.
 */
function bp_core_admin_user_row_actions($actions, $user_object)
{
    if (current_user_can('edit_user', $user_object->ID) && bp_loggedin_user_id() != $user_object->ID) {
        $url = bp_get_admin_url('users.php');
        if (bp_is_user_spammer($user_object->ID)) {
            $actions['ham'] = "<a href='" . wp_nonce_url($url . "?action=ham&amp;user={$user_object->ID}", 'bp-spam-user') . "'>" . __('Not Spam', 'buddypress') . "</a>";
        } else {
            $actions['spam'] = "<a class='submitdelete' href='" . wp_nonce_url($url . "?action=spam&amp;user={$user_object->ID}", 'bp-spam-user') . "'>" . __('Mark as Spam', 'buddypress') . "</a>";
        }
    }
    return $actions;
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:21,代码来源:bp-core-functions.php

示例12: bp_members_admin_bar_user_admin_menu

/**
 * Adds the User Admin top-level menu to user pages
 *
 * @package BuddyPress
 * @since 1.5
 */
function bp_members_admin_bar_user_admin_menu()
{
    global $bp, $wp_admin_bar;
    // Only show if viewing a user
    if (!bp_is_user()) {
        return false;
    }
    // Don't show this menu to non site admins or if you're viewing your own profile
    if (!current_user_can('edit_users') || bp_is_my_profile()) {
        return false;
    }
    // User avatar
    $avatar = bp_core_fetch_avatar(array('item_id' => bp_displayed_user_id(), 'email' => $bp->displayed_user->userdata->user_email, 'width' => 16, 'height' => 16));
    // Unique ID for the 'My Account' menu
    $bp->user_admin_menu_id = !empty($avatar) ? 'user-admin-with-avatar' : 'user-admin';
    // Add the top-level User Admin button
    $wp_admin_bar->add_menu(array('id' => $bp->user_admin_menu_id, 'title' => $avatar . bp_get_displayed_user_fullname(), 'href' => bp_displayed_user_domain()));
    // User Admin > Edit this user's profile
    $wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'edit-profile', 'title' => __("Edit Profile", 'buddypress'), 'href' => bp_get_members_component_link('profile', 'edit')));
    // User Admin > Edit this user's avatar
    $wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'change-avatar', 'title' => __("Edit Avatar", 'buddypress'), 'href' => bp_get_members_component_link('profile', 'change-avatar')));
    // User Admin > Spam/unspam
    if (!bp_is_user_spammer(bp_displayed_user_id())) {
        $wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'spam-user', 'title' => __('Mark as Spammer', 'buddypress'), 'href' => wp_nonce_url(bp_displayed_user_domain() . 'admin/mark-spammer/', 'mark-unmark-spammer'), 'meta' => array('onclick' => 'confirm(" ' . __('Are you sure you want to mark this user as a spammer?', 'buddypress') . '");')));
    } else {
        $wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'unspam-user', 'title' => __('Not a Spammer', 'buddypress'), 'href' => wp_nonce_url(bp_displayed_user_domain() . 'admin/unmark-spammer/', 'mark-unmark-spammer'), 'meta' => array('onclick' => 'confirm(" ' . __('Are you sure you want to mark this user as not a spammer?', 'buddypress') . '");')));
    }
    // User Admin > Delete Account
    $wp_admin_bar->add_menu(array('parent' => $bp->user_admin_menu_id, 'id' => 'delete-user', 'title' => __('Delete Account', 'buddypress'), 'href' => wp_nonce_url(bp_displayed_user_domain() . 'admin/delete-user/', 'delete-user'), 'meta' => array('onclick' => 'confirm(" ' . __("Are you sure you want to delete this user's account?", 'buddypress') . '");')));
}
开发者ID:newington,项目名称:buddypress,代码行数:36,代码来源:bp-members-adminbar.php

示例13: view_users


//.........这里部分代码省略.........

					<tbody>
					<?php 
            foreach ($results as $user) {
                $author = $this->author_details($user->user_id);
                ?>
						<tr class="">
							<th class="check-column"
								scope="row"><input
									type="checkbox"
									value="<?php 
                echo $user->user_id;
                ?>
"
									name="bulk_items[]"></th>
							<td class="column-author">
								<strong><?php 
                echo $author['avatar_img'] . $author['user_link'];
                ?>
</strong>
								<br><?php 
                echo $author['contact_link'];
                ?>
								<div class="row-actions">
									<?php 
                if (!get_userdata($user->user_id)) {
                    ?>
										<span
											class="not-a-member"><?php 
                    _e('Unregistered', 'bp-moderation');
                    ?>
</span>
									<?php 
                } elseif (bp_is_user_spammer($user->user_id)) {
                    ?>
										<a class="unmark-spammer vim-u"
										   href="<?php 
                    echo wp_nonce_url("admin.php?bpmod-action=mark_unmark_spammer&user_id={$user->user_id}&set_spam=0", 'mark_unmark_spammer');
                    ?>
"
										   title="<?php 
                    _e('Mark the author of this content as not spammer', 'bp-moderation');
                    ?>
"><?php 
                    _e('Mark as not spammer', 'bp-moderation');
                    ?>
</a>
									<?php 
                } else {
                    ?>
										<a class="mark-spammer vim-s"
										   href="<?php 
                    echo wp_nonce_url("admin.php?bpmod-action=mark_unmark_spammer&user_id={$user->user_id}&set_spam=1", 'mark_unmark_spammer');
                    ?>
"
										   title="<?php 
                    _e('Mark the author of this content as spammer', 'bp-moderation');
                    ?>
"><?php 
                    _e('Mark as spammer', 'bp-moderation');
                    ?>
</a>
									<?php 
                }
                ?>
								</div>
开发者ID:pausaura,项目名称:agora_nodes,代码行数:67,代码来源:bpModBackend.php

示例14: register_metaboxes

 /**
  * Register the xProfile metabox on Community Profile admin page.
  *
  * @access public
  * @since BuddyPress (2.0.0)
  *
  * @param int $user_id ID of the user being edited.
  * @param string $screen_id Screen ID to load the metabox in.
  * @param object $stats_metabox Context and priority for the stats metabox.
  */
 public function register_metaboxes($user_id = 0, $screen_id = '', $stats_metabox = null)
 {
     if (empty($screen_id)) {
         $screen_id = buddypress()->members->admin->user_page;
     }
     if (empty($stats_metabox)) {
         $stats_metabox = new StdClass();
     }
     // Moving the Stats Metabox
     $stats_metabox->context = 'side';
     $stats_metabox->priority = 'low';
     // Each Group of fields will have his own metabox
     if (false == bp_is_user_spammer($user_id) && bp_has_profile(array('fetch_fields' => false))) {
         while (bp_profile_groups()) {
             bp_the_profile_group();
             add_meta_box('bp_xprofile_user_admin_fields_' . sanitize_key(bp_get_the_profile_group_slug()), esc_html(bp_get_the_profile_group_name()), array(&$this, 'user_admin_profile_metaboxes'), $screen_id, 'normal', 'core', array('profile_group_id' => absint(bp_get_the_profile_group_id())));
         }
         // if a user has been mark as a spammer, remove BP data
     } else {
         add_meta_box('bp_xprofile_user_admin_empty_profile', _x('User marked as a spammer', 'xprofile user-admin edit screen', 'buddypress'), array(&$this, 'user_admin_spammer_metabox'), $screen_id, 'normal', 'core');
     }
     // Avatar Metabox
     add_meta_box('bp_xprofile_user_admin_avatar', _x('Avatar', 'xprofile user-admin edit screen', 'buddypress'), array(&$this, 'user_admin_avatar_metabox'), $screen_id, 'side', 'low');
 }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:34,代码来源:bp-xprofile-admin.php

示例15: bp_core_set_uri_globals


//.........这里部分代码省略.........
        return false;
    }
    $wp_rewrite->use_verbose_page_rules = false;
    // Find the offset. With $root_profile set, we fudge the offset down so later parsing works.
    $slug = !empty($match) ? explode('/', $match->slug) : '';
    $uri_offset = empty($root_profile) ? 0 : -1;
    // Rejig the offset.
    if (!empty($slug) && 1 < count($slug)) {
        // Only offset if not on a root profile. Fixes issue when Members page is nested.
        if (false === $root_profile) {
            array_pop($slug);
            $uri_offset = count($slug);
        }
    }
    // Global the unfiltered offset to use in bp_core_load_template().
    // To avoid PHP warnings in bp_core_load_template(), it must always be >= 0.
    $bp->unfiltered_uri_offset = $uri_offset >= 0 ? $uri_offset : 0;
    // We have an exact match.
    if (isset($match->key)) {
        // Set current component to matched key.
        $bp->current_component = $match->key;
        // If members component, do more work to find the actual component.
        if ('members' == $match->key) {
            $after_member_slug = false;
            if (!empty($bp_uri[$uri_offset + 1])) {
                $after_member_slug = $bp_uri[$uri_offset + 1];
            }
            // Are we viewing a specific user?
            if ($after_member_slug) {
                // If root profile, we've already queried for the user.
                if ($root_profile instanceof WP_User) {
                    $bp->displayed_user->id = $root_profile->ID;
                    // Switch the displayed_user based on compatibility mode.
                } elseif (bp_is_username_compatibility_mode()) {
                    $bp->displayed_user->id = (int) bp_core_get_userid(urldecode($after_member_slug));
                } else {
                    $bp->displayed_user->id = (int) bp_core_get_userid_from_nicename($after_member_slug);
                }
            }
            // Is this a member type directory?
            if (!bp_displayed_user_id() && $after_member_slug === apply_filters('bp_members_member_type_base', _x('type', 'member type URL base', 'buddypress')) && !empty($bp_uri[$uri_offset + 2])) {
                $matched_types = bp_get_member_types(array('has_directory' => true, 'directory_slug' => $bp_uri[$uri_offset + 2]));
                if (!empty($matched_types)) {
                    $bp->current_member_type = reset($matched_types);
                    unset($bp_uri[$uri_offset + 1]);
                }
            }
            // If the slug matches neither a member type nor a specific member, 404.
            if (!bp_displayed_user_id() && !bp_get_current_member_type() && $after_member_slug) {
                // Prevent components from loading their templates.
                $bp->current_component = '';
                bp_do_404();
                return;
            }
            // If the displayed user is marked as a spammer, 404 (unless logged-in user is a super admin).
            if (bp_displayed_user_id() && bp_is_user_spammer(bp_displayed_user_id())) {
                if (bp_current_user_can('bp_moderate')) {
                    bp_core_add_message(__('This user has been marked as a spammer. Only site admins can view this profile.', 'buddypress'), 'warning');
                } else {
                    bp_do_404();
                    return;
                }
            }
            // Bump the offset.
            if (bp_displayed_user_id()) {
                if (isset($bp_uri[$uri_offset + 2])) {
                    $bp_uri = array_merge(array(), array_slice($bp_uri, $uri_offset + 2));
                    $bp->current_component = $bp_uri[0];
                    // No component, so default will be picked later.
                } else {
                    $bp_uri = array_merge(array(), array_slice($bp_uri, $uri_offset + 2));
                    $bp->current_component = '';
                }
                // Reset the offset.
                $uri_offset = 0;
            }
        }
    }
    // Determine the current action.
    $current_action = isset($bp_uri[$uri_offset + 1]) ? $bp_uri[$uri_offset + 1] : '';
    /*
     * If a BuddyPress directory is set to the WP front page, URLs like example.com/members/?s=foo
     * shouldn't interfere with blog searches.
     */
    if (empty($current_action) && !empty($_GET['s']) && 'page' == get_option('show_on_front') && !empty($match->id)) {
        $page_on_front = (int) get_option('page_on_front');
        if ((int) $match->id === $page_on_front) {
            $bp->current_component = '';
            return false;
        }
    }
    $bp->current_action = $current_action;
    // Slice the rest of the $bp_uri array and reset offset.
    $bp_uri = array_slice($bp_uri, $uri_offset + 2);
    $uri_offset = 0;
    // Set the entire URI as the action variables, we will unset the current_component and action in a second.
    $bp->action_variables = $bp_uri;
    // Reset the keys by merging with an empty array.
    $bp->action_variables = array_merge(array(), $bp->action_variables);
}
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:101,代码来源:bp-core-catchuri.php


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