Changeset 6600 for trunk/bp-xprofile/bp-xprofile-screens.php
- Timestamp:
- 12/10/2012 12:52:16 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/bp-xprofile/bp-xprofile-screens.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile/bp-xprofile-screens.php
r6395 r6600 37 37 */ 38 38 function xprofile_screen_edit_profile() { 39 global $bp;40 39 41 40 if ( !bp_is_my_profile() && !bp_current_user_can( 'bp_moderate' ) ) 42 41 return false; 42 43 $bp = buddypress(); 43 44 44 45 // Make sure a group is set. … … 105 106 106 107 // 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. 107 if ( empty( $_POST['field_' . $field_id] ) ) 108 if ( empty( $_POST['field_' . $field_id] ) ) { 108 109 $value = array(); 109 else110 } else { 110 111 $value = $_POST['field_' . $field_id]; 111 112 if ( !xprofile_set_field_data( $field_id, bp_displayed_user_id(), $value, $is_required[$field_id] ) ) 112 } 113 114 if ( !xprofile_set_field_data( $field_id, bp_displayed_user_id(), $value, $is_required[$field_id] ) ) { 113 115 $errors = true; 114 else116 } else { 115 117 do_action( 'xprofile_profile_field_data_updated', $field_id, $value ); 118 } 116 119 117 120 // Save the visibility level … … 123 126 124 127 // Set the feedback messages 125 if ( !empty( $errors ) ) 128 if ( !empty( $errors ) ) { 126 129 bp_core_add_message( __( 'There was a problem updating some of your profile information, please try again.', 'buddypress' ), 'error' ); 127 else130 } else { 128 131 bp_core_add_message( __( 'Changes saved.', 'buddypress' ) ); 132 } 129 133 130 134 // Redirect back to the edit screen to display the updates and message … … 145 149 */ 146 150 function xprofile_screen_change_avatar() { 147 global $bp; 148 151 152 // Bail if not the correct screen 149 153 if ( !bp_is_my_profile() && !bp_current_user_can( 'bp_moderate' ) ) 150 154 return false; 151 155 156 // Bail if there are action variables 152 157 if ( bp_action_variables() ) { 153 158 bp_do_404(); … … 155 160 } 156 161 162 $bp = buddypress(); 163 157 164 if ( ! isset( $bp->avatar_admin ) ) 158 165 $bp->avatar_admin = new stdClass(); … … 180 187 check_admin_referer( 'bp_avatar_cropstore' ); 181 188 182 if ( !bp_core_avatar_handle_crop( array( 'item_id' => bp_displayed_user_id(), 'original_file' => $_POST['image_src'], 'crop_x' => $_POST['x'], 'crop_y' => $_POST['y'], 'crop_w' => $_POST['w'], 'crop_h' => $_POST['h'] ) ) ) 183 bp_core_add_message( __( 'There was a problem cropping your avatar, please try uploading it again', 'buddypress' ), 'error' ); 184 else { 185 bp_core_add_message( __( 'Your new avatar was uploaded successfully!', 'buddypress' ) ); 189 $args = array( 190 'item_id' => bp_displayed_user_id(), 191 'original_file' => $_POST['image_src'], 192 'crop_x' => $_POST['x'], 193 'crop_y' => $_POST['y'], 194 'crop_w' => $_POST['w'], 195 'crop_h' => $_POST['h'] 196 ); 197 198 if ( ! bp_core_avatar_handle_crop( $args ) ) { 199 bp_core_add_message( __( 'There was a problem cropping your avatar.', 'buddypress' ), 'error' ); 200 } else { 201 bp_core_add_message( __( 'Your new avatar was uploaded successfully.', 'buddypress' ) ); 186 202 do_action( 'xprofile_avatar_uploaded' ); 187 203 }
Note: See TracChangeset
for help on using the changeset viewer.