<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][8440] trunk/src/bp-xprofile/bp-xprofile-admin.php: Whitespace, code formatting, and inline doc clean-up in `BP_XProfile_User_Admin`.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/8440">8440</a></dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2014-05-21 16:31:43 +0000 (Wed, 21 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Whitespace, code formatting, and inline doc clean-up in `BP_XProfile_User_Admin`.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpxprofilebpxprofileadminphp">trunk/src/bp-xprofile/bp-xprofile-admin.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpxprofilebpxprofileadminphp"></a>
<div class="modfile"><h4>Modified: trunk/src/bp-xprofile/bp-xprofile-admin.php (8439 => 8440)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/bp-xprofile/bp-xprofile-admin.php      2014-05-21 15:21:05 UTC (rev 8439)
+++ trunk/src/bp-xprofile/bp-xprofile-admin.php 2014-05-21 16:31:43 UTC (rev 8440)
</span><span class="lines">@@ -484,12 +484,15 @@
</span><span class="cx">   * @uses buddypress() to get BuddyPress main instance
</span><span class="cx">   */
</span><span class="cx">  public static function register_xprofile_user_admin() {
</span><del>-               if( ! is_admin() )
</del><ins>+
+               // Bail if not in admin
+               if ( ! is_admin() ) {
</ins><span class="cx">                   return;
</span><ins>+               }
</ins><span class="cx"> 
</span><span class="cx">          $bp = buddypress();
</span><span class="cx"> 
</span><del>-               if( empty( $bp->profile->admin ) ) {
</del><ins>+                if ( empty( $bp->profile->admin ) ) {
</ins><span class="cx">                   $bp->profile->admin = new self;
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="lines">@@ -514,14 +517,11 @@
</span><span class="cx">   */
</span><span class="cx">  private function setup_actions() {
</span><span class="cx"> 
</span><del>-               /** Actions ***************************************************/
-
</del><span class="cx">           // Register the metabox in Member's community admin profile
</span><span class="cx">          add_action( 'bp_members_admin_xprofile_metabox', array( $this, 'register_metaboxes' ), 10, 3 );
</span><span class="cx"> 
</span><span class="cx">          // Saves the profile actions for user ( avatar, profile fields )
</span><del>-               add_action( 'bp_members_admin_update_user',      array( $this, 'user_admin_load' ),    10, 4 );
-
</del><ins>+                add_action( 'bp_members_admin_update_user',      array( $this, 'user_admin_load'    ), 10, 4 );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="lines">@@ -536,32 +536,57 @@
</span><span class="cx">   */
</span><span class="cx">  public function register_metaboxes( $user_id = 0, $screen_id = '', $stats_metabox = null ) {
</span><span class="cx"> 
</span><ins>+               // Set the screen ID if none was passed
</ins><span class="cx">           if ( empty( $screen_id ) ) {
</span><span class="cx">                  $screen_id = buddypress()->members->admin->user_page;
</span><span class="cx">          }
</span><span class="cx"> 
</span><ins>+               // Setup a new metabox class if none was passed
</ins><span class="cx">           if ( empty( $stats_metabox ) ) {
</span><span class="cx">                  $stats_metabox = new StdClass();
</span><span class="cx">          }
</span><span class="cx"> 
</span><span class="cx">          // Moving the Stats Metabox
</span><del>-               $stats_metabox->context = 'side';
</del><ins>+                $stats_metabox->context  = 'side';
</ins><span class="cx">           $stats_metabox->priority = 'low';
</span><span class="cx"> 
</span><span class="cx">          // Each Group of fields will have his own metabox
</span><del>-               if ( false == bp_is_user_spammer( $user_id ) && bp_has_profile( array( 'fetch_fields' => false ) ) ) {
</del><ins>+                if ( ! bp_is_user_spammer( $user_id ) && bp_has_profile( array( 'fetch_fields' => false ) ) ) {
+
+                       // Loop through field groups and add a metabox for each one
</ins><span class="cx">                   while ( bp_profile_groups() ) : bp_the_profile_group();
</span><del>-                               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() ) ) );
</del><ins>+                                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() ) )
+                               );
</ins><span class="cx">                   endwhile;
</span><span class="cx"> 
</span><del>-               // if a user has been mark as a spammer, remove BP data
</del><ins>+                // If member is already a spammer, show a generic metabox
</ins><span class="cx">           } else {
</span><del>-                       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' );
</del><ins>+                        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'
+                       );
</ins><span class="cx">           }
</span><span class="cx"> 
</span><span class="cx">          // Avatar Metabox
</span><del>-               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' );
-
</del><ins>+                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'
+               );
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="lines">@@ -576,7 +601,7 @@
</span><span class="cx">  public function user_admin_load( $doaction = '', $user_id = 0, $request = array(), $redirect_to = '' ) {
</span><span class="cx"> 
</span><span class="cx">          // Eventually delete avatar
</span><del>-               if ( 'delete_avatar' == $doaction ) {
</del><ins>+                if ( 'delete_avatar' === $doaction ) {
</ins><span class="cx"> 
</span><span class="cx">                  check_admin_referer( 'delete_avatar' );
</span><span class="cx"> 
</span><span class="lines">@@ -591,82 +616,83 @@
</span><span class="cx">                  bp_core_redirect( $redirect_to );
</span><span class="cx"> 
</span><span class="cx">          // Update profile fields
</span><del>-               } else {
-                       // Check to see if any new information has been submitted
-                       if ( isset( $_POST['field_ids'] ) ) {
</del><ins>+                } elseif ( isset( $_POST['field_ids'] ) ) {
</ins><span class="cx"> 
</span><del>-                               // Check the nonce
-                               check_admin_referer( 'edit-bp-profile_' . $user_id );
</del><ins>+                        // Check the nonce
+                       check_admin_referer( 'edit-bp-profile_' . $user_id );
</ins><span class="cx"> 
</span><del>-                               // Check we have field ID's
-                               if ( empty( $_POST['field_ids'] ) ) {
-                                       $redirect_to = add_query_arg( 'error', '1', $redirect_to );
-                                       bp_core_redirect( $redirect_to );
-                               }
</del><ins>+                        // Check we have field ID's
+                       if ( empty( $_POST['field_ids'] ) ) {
+                               $redirect_to = add_query_arg( 'error', '1', $redirect_to );
+                               bp_core_redirect( $redirect_to );
+                       }
</ins><span class="cx"> 
</span><del>-                               /**
-                                * Unlike front-end edit-fields screens, the wp-admin/profile displays all 
-                                * groups of fields on a single page, so the list of field ids is an array 
-                                * gathering for each group of fields a distinct comma separated list of ids. 
-                                * As a result, before using the wp_parse_id_list() function, we must ensure 
-                                * that these ids are "merged" into a single comma separated list.
-                                */
-                               $merge_ids = join( ',', $_POST['field_ids'] );
</del><ins>+                        /**
+                        * Unlike front-end edit-fields screens, the wp-admin/profile
+                        * displays all groups of fields on a single page, so the list of
+                        * field ids is an array gathering for each group of fields a
+                        * distinct comma separated list of ids.
+                        *
+                        * As a result, before using the wp_parse_id_list() function, we
+                        * must ensure that these ids are "merged" into a single comma
+                        * separated list.
+                        */
+                       $merge_ids = join( ',', $_POST['field_ids'] );
</ins><span class="cx"> 
</span><del>-                               // Explode the posted field IDs into an array so we know which fields have been submitted
-                               $posted_field_ids = wp_parse_id_list( $merge_ids );
-                               $is_required      = array();
</del><ins>+                        // Explode the posted field IDs into an array so we know which fields have been submitted
+                       $posted_field_ids = wp_parse_id_list( $merge_ids );
+                       $is_required      = array();
</ins><span class="cx"> 
</span><del>-                               // Loop through the posted fields formatting any datebox values then validate the field
-                               foreach ( (array) $posted_field_ids as $field_id ) {
-                                       if ( ! isset( $_POST['field_' . $field_id] ) ) {
-                                               if ( ! empty( $_POST['field_' . $field_id . '_day'] ) && ! empty( $_POST['field_' . $field_id . '_month'] ) && ! empty( $_POST['field_' . $field_id . '_year'] ) ) {
-                                                       // Concatenate the values
-                                                       $date_value =   $_POST['field_' . $field_id . '_day'] . ' ' . $_POST['field_' . $field_id . '_month'] . ' ' . $_POST['field_' . $field_id . '_year'];
</del><ins>+                        // Loop through the posted fields formatting any datebox values then validate the field
+                       foreach ( (array) $posted_field_ids as $field_id ) {
+                               if ( ! isset( $_POST['field_' . $field_id ] ) ) {
+                                       if ( ! empty( $_POST['field_' . $field_id . '_day'] ) && ! empty( $_POST['field_' . $field_id . '_month'] ) && ! empty( $_POST['field_' . $field_id . '_year'] ) ) {
</ins><span class="cx"> 
</span><del>-                                                       // Turn the concatenated value into a timestamp
-                                                       $_POST['field_' . $field_id] = date( 'Y-m-d H:i:s', strtotime( $date_value ) );
-                                               }
-                                       }
</del><ins>+                                                // Concatenate the values
+                                               $date_value =   $_POST['field_' . $field_id . '_day'] . ' ' . $_POST['field_' . $field_id . '_month'] . ' ' . $_POST['field_' . $field_id . '_year'];
</ins><span class="cx"> 
</span><del>-                                       $is_required[ $field_id ] = xprofile_check_is_required_field( $field_id );
-                                       if ( $is_required[ $field_id ] && empty( $_POST['field_' . $field_id] ) ) {
-                                               $redirect_to = add_query_arg( 'error', '2', $redirect_to );
-                                               bp_core_redirect( $redirect_to );
</del><ins>+                                                // Turn the concatenated value into a timestamp
+                                               $_POST['field_' . $field_id] = date( 'Y-m-d H:i:s', strtotime( $date_value ) );
</ins><span class="cx">                                   }
</span><span class="cx">                          }
</span><span class="cx"> 
</span><del>-                               // Set the errors var
-                               $errors = false;
</del><ins>+                                $is_required[ $field_id ] = xprofile_check_is_required_field( $field_id );
+                               if ( $is_required[ $field_id ] && empty( $_POST['field_' . $field_id ] ) ) {
+                                       $redirect_to = add_query_arg( 'error', '2', $redirect_to );
+                                       bp_core_redirect( $redirect_to );
+                               }
+                       }
</ins><span class="cx"> 
</span><del>-                               // Now we've checked for required fields, let's save the values.
-                               foreach ( (array) $posted_field_ids as $field_id ) {
</del><ins>+                        // Set the errors var
+                       $errors = false;
</ins><span class="cx"> 
</span><del>-                                       // Certain types of fields (checkboxes, multiselects) may come through empty. Save them as an empty array so that they don't get overwritten by the default on the next edit.
-                                       $value = isset( $_POST['field_' . $field_id] ) ? $_POST['field_' . $field_id] : '';
</del><ins>+                        // Now we've checked for required fields, let's save the values.
+                       foreach ( (array) $posted_field_ids as $field_id ) {
</ins><span class="cx"> 
</span><del>-                                       if ( ! xprofile_set_field_data( $field_id, $user_id, $value, $is_required[ $field_id ] ) ) {
-                                               $errors = true;
-                                       } else {
-                                               do_action( 'xprofile_profile_field_data_updated', $field_id, $value );
-                                       }
</del><ins>+                                // Certain types of fields (checkboxes, multiselects) may come through empty. Save them as an empty array so that they don't get overwritten by the default on the next edit.
+                               $value = isset( $_POST['field_' . $field_id] ) ? $_POST['field_' . $field_id] : '';
</ins><span class="cx"> 
</span><del>-                                       // Save the visibility level
-                                       $visibility_level = ! empty( $_POST['field_' . $field_id . '_visibility'] ) ? $_POST['field_' . $field_id . '_visibility'] : 'public';
-                                       xprofile_set_field_visibility_level( $field_id, $user_id, $visibility_level );
</del><ins>+                                if ( ! xprofile_set_field_data( $field_id, $user_id, $value, $is_required[ $field_id ] ) ) {
+                                       $errors = true;
+                               } else {
+                                       do_action( 'xprofile_profile_field_data_updated', $field_id, $value );
</ins><span class="cx">                           }
</span><span class="cx"> 
</span><del>-                               do_action( 'xprofile_updated_profile', $user_id, $posted_field_ids, $errors );
</del><ins>+                                // Save the visibility level
+                               $visibility_level = ! empty( $_POST['field_' . $field_id . '_visibility'] ) ? $_POST['field_' . $field_id . '_visibility'] : 'public';
+                               xprofile_set_field_visibility_level( $field_id, $user_id, $visibility_level );
+                       }
</ins><span class="cx"> 
</span><del>-                               // Set the feedback messages
-                               if ( ! empty( $errors ) ) {
-                                       $redirect_to = add_query_arg( 'error', '3', $redirect_to );
-                               } else {
-                                       $redirect_to = add_query_arg( 'updated', '1', $redirect_to );
-                               }
</del><ins>+                        do_action( 'xprofile_updated_profile', $user_id, $posted_field_ids, $errors );
</ins><span class="cx"> 
</span><del>-                               bp_core_redirect( $redirect_to );
</del><ins>+                        // Set the feedback messages
+                       if ( ! empty( $errors ) ) {
+                               $redirect_to = add_query_arg( 'error',   '3', $redirect_to );
+                       } else {
+                               $redirect_to = add_query_arg( 'updated', '1', $redirect_to );
</ins><span class="cx">                   }
</span><ins>+
+                       bp_core_redirect( $redirect_to );
</ins><span class="cx">           }
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="lines">@@ -680,6 +706,7 @@
</span><span class="cx">   */
</span><span class="cx">  public function user_admin_profile_metaboxes( $user = null, $args = array() ) {
</span><span class="cx"> 
</span><ins>+               // Bail if no user ID
</ins><span class="cx">           if ( empty( $user->ID ) ) {
</span><span class="cx">                  return;
</span><span class="cx">          }
</span><span class="lines">@@ -694,57 +721,73 @@
</span><span class="cx">                  return;
</span><span class="cx">          }
</span><span class="cx"> 
</span><del>-               if ( bp_has_profile( $r ) ) :
-                       while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
-                               <input type="hidden" name="field_ids[]" id="<?php echo esc_attr( 'field_ids_' . bp_get_the_profile_group_slug() ); ?>" value="<?php echo esc_attr( bp_get_the_profile_group_field_ids() ); ?>" />
</del><ins>+                // Bail if no profile fields are available
+               if ( ! bp_has_profile( $r ) ) {
+                       return;
+               }
</ins><span class="cx"> 
</span><del>-                               <?php if ( bp_get_the_profile_group_description() ) : ?>
-                                       <p class="description"><?php bp_the_profile_group_description(); ?></p>
-                               <?php
-                               endif;
</del><ins>+                // Loop through profile groups & fields
+               while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
</ins><span class="cx"> 
</span><del>-                               while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
</del><ins>+                        <input type="hidden" name="field_ids[]" id="<?php echo esc_attr( 'field_ids_' . bp_get_the_profile_group_slug() ); ?>" value="<?php echo esc_attr( bp_get_the_profile_group_field_ids() ); ?>" />
</ins><span class="cx"> 
</span><del>-                                       <div<?php bp_field_css_class( 'bp-profile-field' ); ?>>
-                                               <?php
-                                               $field_type = bp_xprofile_create_field_type( bp_get_the_profile_field_type() );
-                                               $field_type->edit_field_html( array( 'user_id' => $r['user_id'] ) );
</del><ins>+                        <?php if ( bp_get_the_profile_group_description() ) : ?>
</ins><span class="cx"> 
</span><del>-                                               if ( bp_get_the_profile_field_description() ) : ?>
-                                                       <p class="description"><?php bp_the_profile_field_description(); ?></p>
-                                               <?php endif;
</del><ins>+                                <p class="description"><?php bp_the_profile_group_description(); ?></p>
</ins><span class="cx"> 
</span><del>-                                               do_action( 'bp_custom_profile_edit_fields_pre_visibility' );
-                                               $can_change_visibility = bp_current_user_can( 'bp_xprofile_change_field_visibility' );
-                                               ?>
</del><ins>+                        <?php endif; ?>
</ins><span class="cx"> 
</span><del>-                                               <p class="field-visibility-settings-<?php echo $can_change_visibility ? 'toggle' : 'notoggle'; ?>" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id(); ?>">
-                                                       <?php
-                                                       printf( __( 'This field can be seen by: <span class="%s">%s</span>', 'buddypress' ), esc_attr( 'current-visibility-level' ), bp_get_the_profile_field_visibility_level_label() );
</del><ins>+                        <?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
</ins><span class="cx"> 
</span><del>-                                                       if ( $can_change_visibility ) : ?>
-                                                                <a href="#" class="button visibility-toggle-link"><?php _e( 'Change', 'buddypress' ); ?></a>
-                                                       <?php endif; ?>
-                                               </p>
</del><ins>+                                <div<?php bp_field_css_class( 'bp-profile-field' ); ?>>
</ins><span class="cx"> 
</span><ins>+                                       <?php
+
+                                       $field_type = bp_xprofile_create_field_type( bp_get_the_profile_field_type() );
+                                       $field_type->edit_field_html( array( 'user_id' => $r['user_id'] ) );
+
+                                       if ( bp_get_the_profile_field_description() ) : ?>
+
+                                               <p class="description"><?php bp_the_profile_field_description(); ?></p>
+
+                                       <?php endif;
+
+                                       do_action( 'bp_custom_profile_edit_fields_pre_visibility' );
+
+                                       $can_change_visibility = bp_current_user_can( 'bp_xprofile_change_field_visibility' ); ?>
+
+                                       <p class="field-visibility-settings-<?php echo $can_change_visibility ? 'toggle' : 'notoggle'; ?>" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id(); ?>">
+
+                                               <?php printf( __( 'This field can be seen by: <span class="%s">%s</span>', 'buddypress' ), esc_attr( 'current-visibility-level' ), bp_get_the_profile_field_visibility_level_label() ); ?>
+
</ins><span class="cx">                                           <?php if ( $can_change_visibility ) : ?>
</span><del>-                                                       <div class="field-visibility-settings" id="field-visibility-settings-<?php bp_the_profile_field_id() ?>">
-                                                               <fieldset>
-                                                                       <legend><?php _e( 'Who can see this field?', 'buddypress' ); ?></legend>
-                                                                       <?php bp_profile_visibility_radio_buttons(); ?>
-                                                               </fieldset>
-                                                               <a class="button field-visibility-settings-close" href="#"><?php _e( 'Close', 'buddypress' ); ?></a>
-                                                       </div>
-                                               <?php endif;
</del><span class="cx"> 
</span><del>-                                               do_action( 'bp_custom_profile_edit_fields' ); ?>
-                                       </div>
</del><ins>+                                                        <a href="#" class="button visibility-toggle-link"><?php esc_html_e( 'Change', 'buddypress' ); ?></a>
</ins><span class="cx"> 
</span><del>-                               <?php
-                               endwhile; // bp_profile_fields()
</del><ins>+                                                <?php endif; ?>
+                                       </p>
</ins><span class="cx"> 
</span><del>-                       endwhile; // bp_profile_groups()
-               endif;
</del><ins>+                                        <?php if ( $can_change_visibility ) : ?>
+
+                                               <div class="field-visibility-settings" id="field-visibility-settings-<?php bp_the_profile_field_id() ?>">
+                                                       <fieldset>
+                                                               <legend><?php _e( 'Who can see this field?', 'buddypress' ); ?></legend>
+
+                                                               <?php bp_profile_visibility_radio_buttons(); ?>
+
+                                                       </fieldset>
+                                                       <a class="button field-visibility-settings-close" href="#"><?php esc_html_e( 'Close', 'buddypress' ); ?></a>
+                                               </div>
+
+                                       <?php endif; ?>
+
+                                       <?php do_action( 'bp_custom_profile_edit_fields' ); ?>
+
+                               </div>
+
+                       <?php endwhile; // bp_profile_fields() ?>
+
+               <?php endwhile; // bp_profile_groups
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="lines">@@ -756,9 +799,9 @@
</span><span class="cx">   * @param WP_User $user The WP_User object for the user being edited.
</span><span class="cx">   */
</span><span class="cx">  public function user_admin_spammer_metabox( $user = null ) {
</span><del>-               ?>
</del><ins>+        ?>
</ins><span class="cx">           <p><?php printf( __( '%s has been marked as a spammer. All BuddyPress data associated with the user has been removed', 'buddypress' ), esc_html( bp_core_get_user_displayname( $user->ID ) ) ) ;?></p>
</span><del>-               <?php
</del><ins>+        <?php
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">  /**
</span><span class="lines">@@ -773,20 +816,16 @@
</span><span class="cx"> 
</span><span class="cx">          if ( empty( $user->ID ) ) {
</span><span class="cx">                  return;
</span><del>-               }
</del><ins>+                } ?>
</ins><span class="cx"> 
</span><del>-               $args = array(
-                       'item_id' => $user->ID,
-                       'object'  => 'user',
-                       'type'    => 'full',
-                       'title'   => $user->display_name
-               );
-
-               ?>
-
</del><span class="cx">           <div class="avatar">
</span><span class="cx"> 
</span><del>-                       <?php echo bp_core_fetch_avatar( $args ); ?>
</del><ins>+                        <?php echo bp_core_fetch_avatar( array(
+                               'item_id' => $user->ID,
+                               'object'  => 'user',
+                               'type'    => 'full',
+                               'title'   => $user->display_name
+                       ) ); ?>
</ins><span class="cx"> 
</span><span class="cx">                  <?php if ( bp_get_user_has_avatar( $user->ID ) ) :
</span><span class="cx"> 
</span><span class="lines">@@ -795,11 +834,12 @@
</span><span class="cx">                                  'action'  => 'delete_avatar'
</span><span class="cx">                          );
</span><span class="cx"> 
</span><del>-                               if ( ! empty( $_REQUEST['wp_http_referer'] ) )
</del><ins>+                                if ( ! empty( $_REQUEST['wp_http_referer'] ) ) {
</ins><span class="cx">                                   $query_args['wp_http_referer'] = urlencode( wp_unslash( $_REQUEST['wp_http_referer'] ) );
</span><ins>+                               }
</ins><span class="cx"> 
</span><del>-                                       $community_url = add_query_arg( $query_args, buddypress()->members->admin->edit_profile_url );
-                                       $delete_link   = wp_nonce_url( $community_url, 'delete_avatar' ); ?>
</del><ins>+                                $community_url = add_query_arg( $query_args, buddypress()->members->admin->edit_profile_url );
+                               $delete_link   = wp_nonce_url( $community_url, 'delete_avatar' ); ?>
</ins><span class="cx"> 
</span><span class="cx">                          <a href="<?php echo esc_url( $delete_link ); ?>" title="<?php esc_attr_e( 'Delete Avatar', 'buddypress' ); ?>" class="bp-xprofile-avatar-user-admin"><?php esc_html_e( 'Delete Avatar', 'buddypress' ); ?></a></li>
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>