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

1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
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

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.