BP_Members_Admin::user_admin_status_metabox( WP_User|null $user = null )
Render the Status metabox for user’s profile screen.
Description
Actions are:
- Update profile fields if xProfile component is active
- Spam/Unspam user
Parameters
- $user
-
(Optional) The WP_User object to be edited.
Default value: null
Source
File: bp-members/classes/class-bp-members-admin.php
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', 'buddyboss' ); ?></p><br/> <?php return; endif; ?> <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 the back end. * * 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', 'buddyboss' ); ?></label><br /> <label class="spam"><input type="radio" name="user_status" value="spam" <?php checked( $is_spammer, true ); ?>><?php esc_html_e( 'Spammer', 'buddyboss' ); ?></label> </div> <?php endif ;?> <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', 'buddyboss' ); $date = date_i18n( $datef, strtotime( $user->user_registered ) ); ?> <span id="timestamp"><?php printf( __( 'Registered on: %s', 'buddyboss' ), '<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', 'buddyboss' ); ?></a> <?php submit_button( esc_html__( 'Update Profile', 'buddyboss' ), 'primary', 'save', false ); ?> </div> <div class="clear"></div> </div><!-- #major-publishing-actions --> </div><!-- #submitcomment --> <?php }
Changelog
Version | Description |
---|---|
BuddyPress 2.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.