BP_Members_Admin::user_admin()
Display the user’s profile.
Description
Source
File: bp-members/classes/class-bp-members-admin.php
public function user_admin() { if ( ! bp_current_user_can( 'bp_moderate' ) && empty( $this->is_self_profile ) ) { die( '-1' ); } // Get the user ID. $user_id = $this->get_user_id(); $user = get_user_to_edit( $user_id ); // Construct title. if ( true === $this->is_self_profile ) { $title = __( 'Profile', 'buddyboss' ); } else { $title = __( 'Edit User', 'buddyboss' ); } // Construct URL for form. $request_url = remove_query_arg( array( 'action', 'error', 'updated', 'spam', 'ham' ), $_SERVER['REQUEST_URI'] ); $form_action_url = add_query_arg( 'action', 'update', $request_url ); $wp_http_referer = false; if ( ! empty( $_REQUEST['wp_http_referer'] ) ) { $wp_http_referer = wp_unslash( $_REQUEST['wp_http_referer'] ); $wp_http_referer = remove_query_arg( array( 'action', 'updated' ), $wp_http_referer ); $wp_http_referer = wp_validate_redirect( esc_url_raw( $wp_http_referer ) ); } // Prepare notice for admin. $notice = $this->get_user_notice(); if ( ! empty( $notice ) ) : ?> <div <?php if ( 'updated' === $notice['class'] ) : ?>id="message" <?php endif; ?>class="<?php echo esc_attr( $notice['class'] ); ?>"> <p><?php echo esc_html( $notice['message'] ); ?></p> <?php if ( !empty( $wp_http_referer ) && ( 'updated' === $notice['class'] ) ) : ?> <p><a href="<?php echo esc_url( $wp_http_referer ); ?>"><?php esc_html_e( '← Back to Users', 'buddyboss' ); ?></a></p> <?php endif; ?> </div> <?php endif; ?> <div class="wrap" id="community-profile-page"> <?php if ( version_compare( $GLOBALS['wp_version'], '4.8', '>=' ) ) : ?> <h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1> <?php if ( empty( $this->is_self_profile ) ) : ?> <?php if ( current_user_can( 'create_users' ) ) : ?> <a href="user-new.php" class="page-title-action"><?php echo esc_html__( 'Add New', 'buddyboss' ); ?></a> <?php elseif ( is_multisite() && current_user_can( 'promote_users' ) ) : ?> <a href="user-new.php" class="page-title-action"><?php echo esc_html__( 'Add Existing', 'buddyboss' ); ?></a> <?php endif; ?> <?php endif; ?> <hr class="wp-header-end"> <?php else : ?> <h1><?php echo esc_html( $title ); ?> <?php if ( empty( $this->is_self_profile ) ) : ?> <?php if ( current_user_can( 'create_users' ) ) : ?> <a href="user-new.php" class="add-new-h2"><?php echo esc_html__( 'Add New', 'buddyboss' ); ?></a> <?php elseif ( is_multisite() && current_user_can( 'promote_users' ) ) : ?> <a href="user-new.php" class="add-new-h2"><?php echo esc_html__( 'Add Existing', 'buddyboss' ); ?></a> <?php endif; ?> <?php endif; ?> </h1> <?php endif; ?> <?php if ( ! empty( $user ) ) : $this->profile_nav( $user, 'BuddyPress' ); ?> <form action="<?php echo esc_url( $form_action_url ); ?>" id="your-profile" method="post"> <div id="poststuff"> <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> <div id="postbox-container-1" class="postbox-container"> <?php do_meta_boxes( get_current_screen()->id, 'side', $user ); ?> </div> <div id="postbox-container-2" class="postbox-container"> <?php do_meta_boxes( get_current_screen()->id, 'normal', $user ); ?> <?php do_meta_boxes( get_current_screen()->id, 'advanced', $user ); ?> </div> </div><!-- #post-body --> </div><!-- #poststuff --> <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> <?php wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> <?php wp_nonce_field( 'edit-bp-profile_' . $user->ID ); ?> </form> <?php else : ?> <p><?php printf( '%1$s <a href="%2$s">%3$s</a>', __( 'No user found with this ID.', 'buddyboss' ), esc_url( bp_get_admin_url( 'users.php' ) ), __( 'Go back and try again.', 'buddyboss' ) ); ?></p> <?php endif; ?> </div><!-- .wrap --> <?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.