diff --git src/bp-core/bp-core-avatars.php src/bp-core/bp-core-avatars.php
index 98f2a3a..46d443b 100644
|
|
function bp_avatar_ajax_upload() { |
991 | 991 | $name_parts = pathinfo( $name ); |
992 | 992 | $name = trim( substr( $name, 0, - ( 1 + strlen( $name_parts['extension'] ) ) ) ); |
993 | 993 | |
994 | | if ( 'user' === $bp_params['object'] ) { |
995 | | do_action( 'xprofile_avatar_uploaded' ); |
996 | | } |
997 | | |
998 | 994 | // Finally return the avatar to the editor |
999 | 995 | bp_attachments_json_response( true, $is_html4, array( |
1000 | 996 | 'name' => $name, |
… |
… |
function bp_avatar_handle_capture( $data = '', $item_id = 0 ) { |
1057 | 1053 | // Crop to default values |
1058 | 1054 | $crop_args = array( 'item_id' => $item_id, 'original_file' => $avatar_to_crop, 'crop_x' => 0, 'crop_y' => 0 ); |
1059 | 1055 | |
1060 | | /** |
1061 | | * Fires if the new avatar was successfully captured. |
1062 | | * |
1063 | | * @since 2.3.0 |
1064 | | */ |
1065 | | do_action( 'xprofile_avatar_uploaded' ); |
1066 | | |
1067 | 1056 | return bp_core_avatar_handle_crop( $crop_args ); |
1068 | 1057 | } else { |
1069 | 1058 | return false; |
… |
… |
function bp_avatar_ajax_set() { |
1200 | 1189 | 'item_id' => $avatar_data['item_id'], |
1201 | 1190 | ); |
1202 | 1191 | |
1203 | | do_action( 'xprofile_screen_change_avatar' ); |
| 1192 | /** |
| 1193 | * Fires if the new avatar was successfully captured. |
| 1194 | * |
| 1195 | * @since 1.1.0 Used to inform the avatar was successfully cropped |
| 1196 | * @since 2.3.4 Add a new parameter to inform about the way the avatar was set. |
| 1197 | * eg: 'crop' or 'camera' |
| 1198 | * Move the action at the right place, once the avatar is set |
| 1199 | * |
| 1200 | * @param string $type Inform about the way the avatar was set ('camera') |
| 1201 | */ |
| 1202 | do_action( 'xprofile_avatar_uploaded', $avatar_data['type'] ); |
1204 | 1203 | |
1205 | 1204 | wp_send_json_success( $return ); |
1206 | 1205 | } |
… |
… |
function bp_avatar_ajax_set() { |
1245 | 1244 | ); |
1246 | 1245 | |
1247 | 1246 | if ( 'user' === $avatar_data['object'] ) { |
1248 | | do_action( 'xprofile_screen_change_avatar' ); |
| 1247 | /** |
| 1248 | * Fires if the new avatar was successfully cropped. |
| 1249 | * |
| 1250 | * @since 1.1.0 Used to inform the avatar was successfully cropped |
| 1251 | * @since 2.3.4 Add a new parameter to inform about the way the avatar was set. |
| 1252 | * eg: 'crop' or 'camera' |
| 1253 | * Move the action at the right place, once the avatar is set |
| 1254 | * |
| 1255 | * @param string $type Inform about the way the avatar was set ('crop') |
| 1256 | */ |
| 1257 | do_action( 'xprofile_avatar_uploaded', $avatar_data['type'] ); |
1249 | 1258 | } |
1250 | 1259 | |
1251 | 1260 | wp_send_json_success( $return ); |
diff --git src/bp-xprofile/bp-xprofile-screens.php src/bp-xprofile/bp-xprofile-screens.php
index afb4604..f4166ca 100644
|
|
function xprofile_screen_change_avatar() { |
266 | 266 | /** |
267 | 267 | * Fires right before the redirect, after processing a new avatar. |
268 | 268 | * |
269 | | * @since BuddyPress (1.1.0) |
| 269 | * @since 1.1.0 |
| 270 | * @since 2.3.4 Add a new parameter to inform about the way the avatar was set. |
| 271 | * eg: 'crop' or 'camera' |
| 272 | * |
| 273 | * @param string $value Inform about the way the avatar was set ('crop') |
270 | 274 | */ |
271 | | do_action( 'xprofile_avatar_uploaded' ); |
| 275 | do_action( 'xprofile_avatar_uploaded', 'crop' ); |
272 | 276 | bp_core_add_message( __( 'Your new profile photo was uploaded successfully.', 'buddypress' ) ); |
273 | 277 | bp_core_redirect( bp_displayed_user_domain() ); |
274 | 278 | } |