Changeset 13180 for trunk/src/bp-members/bp-members-activity.php
- Timestamp:
- 12/11/2021 07:40:10 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-members/bp-members-activity.php
r13177 r13180 251 251 } 252 252 add_action( 'bp_members_avatar_uploaded', 'bp_members_new_avatar_activity', 10, 4 ); 253 254 /** 255 * Remove the `new_avatar` activity corresponding to the deleted previous avatar. 256 * 257 * @since 10.0.0 258 * 259 * @param int $user_id The user ID. 260 * @param int $timestamp The timestamp when the activity was created. 261 * @return bool True on success. False otherwise. 262 */ 263 function bp_members_remove_previous_avatar_activity( $user_id = 0, $timestamp = 0 ) { 264 if ( ! $user_id || ! $timestamp || ! bp_is_active( 'activity' ) ) { 265 return false; 266 } 267 268 // Look for a `new_avatar` activity corresponding to the date and user. 269 $activity_id = BP_Activity_Activity::get_id( 270 array( 271 'user_id' => $user_id, 272 'component' => buddypress()->members->id, 273 'type' => 'new_avatar', 274 'date_recorded' => date( 'Y-m-d H:i:s', $timestamp ), 275 ) 276 ); 277 278 if ( $activity_id ) { 279 return bp_activity_delete( 280 array( 281 'id' => $activity_id, 282 ) 283 ); 284 } 285 286 return false; 287 } 288 add_action( 'bp_previous_user_avatar_deleted', 'bp_members_remove_previous_avatar_activity', 10, 2 );
Note: See TracChangeset
for help on using the changeset viewer.