Changeset 10134
- Timestamp:
- 09/24/2015 10:28:21 AM (9 years ago)
- Location:
- branches/2.3/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.3/src/bp-core/bp-core-avatars.php
r9860 r10134 988 988 $name = trim( substr( $name, 0, - ( 1 + strlen( $name_parts['extension'] ) ) ) ); 989 989 990 if ( 'user' === $bp_params['object'] ) {991 do_action( 'xprofile_avatar_uploaded' );992 }993 994 990 // Finally return the avatar to the editor 995 991 bp_attachments_json_response( true, $is_html4, array( … … 1042 1038 // Crop to default values 1043 1039 $crop_args = array( 'item_id' => $item_id, 'original_file' => $avatar_to_crop, 'crop_x' => 0, 'crop_y' => 0 ); 1044 1045 do_action( 'xprofile_avatar_uploaded' );1046 1040 1047 1041 return bp_core_avatar_handle_crop( $crop_args ); … … 1179 1173 ); 1180 1174 1181 do_action( 'xprofile_screen_change_avatar' ); 1175 /** 1176 * Fires if the new avatar was successfully captured. 1177 * 1178 * @since 1.1.0 Used to inform the avatar was successfully cropped 1179 * @since 2.3.4 Add two new parameters to inform about the user id and 1180 * about the way the avatar was set (eg: 'crop' or 'camera') 1181 * Move the action at the right place, once the avatar is set 1182 * 1183 * @param string $item_id Inform about the user id the avatar was set for 1184 * @param string $type Inform about the way the avatar was set ('camera') 1185 */ 1186 do_action( 'xprofile_avatar_uploaded', (int) $avatar_data['item_id'], $avatar_data['type'] ); 1182 1187 1183 1188 wp_send_json_success( $return ); … … 1224 1229 1225 1230 if ( 'user' === $avatar_data['object'] ) { 1226 do_action( 'xprofile_screen_change_avatar' ); 1231 /** 1232 * Fires if the new avatar was successfully cropped. 1233 * 1234 * @since 1.1.0 Used to inform the avatar was successfully cropped 1235 * @since 2.3.4 Add two new parameters to inform about the user id and 1236 * about the way the avatar was set (eg: 'crop' or 'camera') 1237 * Move the action at the right place, once the avatar is set 1238 * 1239 * @param string $item_id Inform about the user id the avatar was set for 1240 * @param string $type Inform about the way the avatar was set ('crop') 1241 */ 1242 do_action( 'xprofile_avatar_uploaded', (int) $avatar_data['item_id'], $avatar_data['type'] ); 1227 1243 } 1228 1244 -
branches/2.3/src/bp-xprofile/bp-xprofile-activity.php
r9819 r10134 203 203 * Adds an activity stream item when a user has uploaded a new avatar. 204 204 * 205 * @since BuddyPress (1.0.0) 205 * @since 1.0.0 206 * @since 2.3.4 Add new parameter to get the user id the avatar was set for 206 207 * 207 208 * @package BuddyPress XProfile 208 209 * @uses bp_activity_add() Adds an entry to the activity component tables for a 209 210 * specific activity 210 */ 211 function bp_xprofile_new_avatar_activity() { 212 213 // Bail if activity component is not active 214 if ( ! bp_is_active( 'activity' ) ) { 215 return false; 211 * 212 * @param int $user_id The user id the avatar was set for 213 */ 214 function bp_xprofile_new_avatar_activity( $user_id = 0 ) { 215 216 // Bail if activity component is not active 217 if ( ! bp_is_active( 'activity' ) ) { 218 return false; 219 } 220 221 if ( empty( $user_id ) ) { 222 $user_id = bp_displayed_user_id(); 216 223 } 217 224 … … 219 226 * Filters the user ID when a user has uploaded a new avatar. 220 227 * 221 * @since BuddyPress (1.5.0)222 * 223 * @param int $ value ID of the displayed user.224 */ 225 $user_id = apply_filters( 'bp_xprofile_new_avatar_user_id', bp_displayed_user_id());228 * @since 1.5.0 229 * 230 * @param int $user_id ID of the user the avatar was set for. 231 */ 232 $user_id = apply_filters( 'bp_xprofile_new_avatar_user_id', $user_id ); 226 233 227 234 // Add the activity -
branches/2.3/src/bp-xprofile/bp-xprofile-screens.php
r9819 r10134 264 264 * Fires right before the redirect, after processing a new avatar. 265 265 * 266 * @since BuddyPress (1.1.0) 266 * @since 1.1.0 267 * @since 2.3.4 Add two new parameters to inform about the user id and 268 * about the way the avatar was set (eg: 'crop' or 'camera') 269 * 270 * @param string $item_id Inform about the user id the avatar was set for 271 * @param string $value Inform about the way the avatar was set ('crop') 267 272 */ 268 do_action( 'xprofile_avatar_uploaded' );273 do_action( 'xprofile_avatar_uploaded', (int) $args['item_id'], 'crop' ); 269 274 bp_core_add_message( __( 'Your new profile photo was uploaded successfully.', 'buddypress' ) ); 270 275 bp_core_redirect( bp_displayed_user_domain() );
Note: See TracChangeset
for help on using the changeset viewer.