Changeset 8125 for trunk/bp-xprofile/bp-xprofile-activity.php
- Timestamp:
- 03/13/2014 06:34:06 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-xprofile/bp-xprofile-activity.php
r7998 r8125 18 18 19 19 // Register the activity stream actions for this component 20 bp_activity_set_action( $bp->profile->id, 'new_avatar', __( 'Member changed profile picture', 'buddypress' ) ); 21 bp_activity_set_action( $bp->profile->id, 'new_member', __( 'New member registered', 'buddypress' ) ); 22 bp_activity_set_action( $bp->profile->id, 'updated_profile', __( 'Updated Profile', 'buddypress' ) ); 20 bp_activity_set_action( 21 $bp->profile->id, 22 'new_avatar', 23 __( 'Member changed profile picture', 'buddypress' ), 24 'bp_xprofile_format_activity_action_new_avatar' 25 ); 26 27 bp_activity_set_action( 28 $bp->profile->id, 29 'new_member', 30 __( 'New member registered', 'buddypress' ), 31 'bp_xprofile_format_activity_action_new_member' 32 ); 33 34 bp_activity_set_action( 35 $bp->profile->id, 36 'updated_profile', 37 __( 'Updated Profile', 'buddypress' ), 38 'bp_xprofile_format_activity_action_updated_profile' 39 ); 23 40 24 41 do_action( 'xprofile_register_activity_actions' ); 25 42 } 26 43 add_action( 'bp_register_activity_actions', 'xprofile_register_activity_actions' ); 44 45 /** 46 * Format 'new_avatar' activity actions. 47 * 48 * @since BuddyPress (2.0.0) 49 * 50 * @param object $activity Activity object. 51 * @return string 52 */ 53 function bp_xprofile_format_activity_action_new_avatar( $activity ) { 54 $userlink = bp_core_get_userlink( $activity->user_id ); 55 $action = sprintf( __( '%s changed their profile picture', 'buddypress' ), $userlink ); 56 57 // Legacy filter - pass $user_id instead of $activity 58 if ( has_filter( 'bp_xprofile_new_avatar_action' ) ) { 59 $action = apply_filters( 'bp_xprofile_new_avatar_action', $action, $activity->user_id ); 60 } 61 62 return apply_filters( 'bp_xprofile_format_activity_action_new_avatar', $action, $activity ); 63 } 64 65 /** 66 * Format 'new_member' activity actions. 67 * 68 * @since BuddyPress (2.0.0) 69 * 70 * @param object $activity Activity object. 71 * @return string 72 */ 73 function bp_xprofile_format_activity_action_new_member( $activity ) { 74 $userlink = bp_core_get_userlink( $activity->user_id ); 75 $action = sprintf( __( '%s became a registered member', 'buddypress' ), $userlink ); 76 77 // Legacy filter - pass $user_id instead of $activity 78 if ( has_filter( 'bp_core_activity_registered_member_action' ) ) { 79 $action = apply_filters( 'bp_core_activity_registered_member_action', $action, $activity->user_id ); 80 } 81 82 return apply_filters( 'bp_xprofile_format_activity_action_new_member', $action, $activity ); 83 } 84 85 /** 86 * Format 'updated_profile' activity actions. 87 * 88 * @since BuddyPress (2.0.0) 89 * 90 * @param object $activity Activity object. 91 * @return string 92 */ 93 function bp_xprofile_format_activity_action_updated_profile( $activity ) { 94 // Note for translators: The natural phrasing in English, "Joe updated 95 // his profile", requires that we know Joe's gender, which we don't. If 96 // your language doesn't have this restriction, feel free to use a more 97 // natural translation. 98 $profile_link = trailingslashit( bp_core_get_user_domain( $activity->user_id ) . buddypress()->profile->slug ); 99 $action = sprintf( __( '%1$s’s profile was updated', 'buddypress' ), '<a href="' . $profile_link . '">' . bp_core_get_user_displayname( $activity->user_id ) . '</a>' ); 100 101 return apply_filters( 'bp_xprofile_format_activity_action_updated_profile', $action, $activity ); 102 } 27 103 28 104 /** … … 127 203 bp_activity_add( array( 128 204 'user_id' => $user_id, 129 'action' => apply_filters( 'bp_xprofile_new_avatar_action', sprintf( __( '%s changed their profile picture', 'buddypress' ), $userlink ), $user_id ),130 205 'component' => 'profile', 131 206 'type' => 'new_avatar' … … 208 283 209 284 // If we've reached this point, assemble and post the activity item 210 211 // Note for translators: The natural phrasing in English, "Joe updated212 // his profile", requires that we know Joe's gender, which we don't. If213 // your language doesn't have this restriction, feel free to use a more214 // natural translation.215 285 $profile_link = trailingslashit( bp_core_get_user_domain( $user_id ) . buddypress()->profile->slug ); 216 $action = sprintf( __( '%1$s’s profile was updated', 'buddypress' ), '<a href="' . $profile_link . '">' . bp_core_get_user_displayname( $user_id ) . '</a>' );217 286 218 287 $retval = xprofile_record_activity( array( 219 288 'user_id' => $user_id, 220 'action' => $action,221 289 'primary_link' => $profile_link, 222 290 'component' => buddypress()->profile->id,
Note: See TracChangeset
for help on using the changeset viewer.