Changeset 9273
- Timestamp:
- 12/24/2014 04:35:52 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-classes.php
r9263 r9273 434 434 if ( empty( $r['filter']['object'] ) ) { 435 435 $excluded_types[] = 'last_activity'; 436 }437 438 // Exclude 'new_member' items if xprofile component is not active439 if ( ! bp_is_active( 'xprofile' ) ) {440 $excluded_types[] = 'new_member';441 436 } 442 437 -
trunk/src/bp-core/bp-core-update.php
r9182 r9273 399 399 * 400 400 * - Add messages meta table 401 * - Update the component field of the 'new members' activity type 401 402 * 402 403 * @since BuddyPress (2.2.0) … … 406 407 bp_core_install_private_messaging(); 407 408 } 409 410 if ( bp_is_active( 'activity' ) ) { 411 bp_migrate_new_member_activity_component(); 412 } 413 } 414 415 /** 416 * Updates the component field for new_members type. 417 * 418 * @since BuddyPress (2.2.0) 419 * 420 * @global $wpdb 421 * @uses buddypress() 422 * 423 */ 424 function bp_migrate_new_member_activity_component() { 425 global $wpdb; 426 $bp = buddypress(); 427 428 // Update the component for the new_member type 429 $wpdb->update( 430 // Activity table 431 $bp->members->table_name_last_activity, 432 array( 433 'component' => $bp->members->id, 434 ), 435 array( 436 'component' => 'xprofile', 437 'type' => 'new_member', 438 ), 439 // Data sanitization format 440 array( 441 '%s', 442 ), 443 // WHERE sanitization format 444 array( 445 '%s', 446 '%s' 447 ) 448 ); 408 449 } 409 450 -
trunk/src/bp-core/deprecated/2.2.php
r9251 r9273 78 78 bp_blogs_clear_blog_object_cache( false, $recorded_blog_obj->user_id ); 79 79 } 80 81 /** 82 * Format 'new_member' activity actions. 83 * 84 * @since BuddyPress (2.0.0) 85 * @deprecated BuddyPress (2.2.0) 86 * 87 * @param string $action Static activity action. 88 * @param object $activity Activity object. 89 * @return string 90 */ 91 function bp_xprofile_format_activity_action_new_member( $action, $activity ) { 92 _deprecated_function( __FUNCTION__, '2.2', 'bp_members_format_activity_action_new_member()' ); 93 94 $action = apply_filters( 'bp_xprofile_format_activity_action_new_member', $action, $activity ); 95 return bp_members_format_activity_action_new_member( $action, $activity ); 96 } -
trunk/src/bp-members/bp-members-functions.php
r9270 r9273 2126 2126 2127 2127 /** 2128 * Create a "became a registered user" activity item when a user activates his account.2129 *2130 * @param array $user Array of userdata passed to bp_core_activated_user hook.2131 */2132 function bp_core_new_user_activity( $user ) {2133 if ( empty( $user ) || ! bp_is_active( 'activity' ) || ! bp_is_active( 'xprofile' ) ) {2134 return false;2135 }2136 2137 if ( is_array( $user ) ) {2138 $user_id = $user['user_id'];2139 } else {2140 $user_id = $user;2141 }2142 2143 if ( empty( $user_id ) ) {2144 return false;2145 }2146 2147 bp_activity_add( array(2148 'user_id' => $user_id,2149 'component' => 'xprofile',2150 'type' => 'new_member'2151 ) );2152 }2153 add_action( 'bp_core_activated_user', 'bp_core_new_user_activity' );2154 2155 /**2156 2128 * Map a user's WP display name to the XProfile fullname field, if necessary. 2157 2129 * -
trunk/src/bp-members/bp-members-loader.php
r9210 r9273 59 59 'cache', 60 60 ); 61 62 if ( bp_is_active( 'activity' ) ) { 63 $includes[] = 'activity'; 64 } 61 65 62 66 // Include these only if in admin -
trunk/src/bp-xprofile/bp-xprofile-activity.php
r8814 r9273 34 34 ); 35 35 36 // Get the profile component ID37 $profile_id = buddypress()->profile->id;38 39 36 bp_activity_set_action( 40 $profile_id, 41 'new_member', 42 __( 'New member registered', 'buddypress' ), 43 'bp_xprofile_format_activity_action_new_member', 44 __( 'New Members', 'buddypress' ), 45 array( 'activity' ) 46 ); 47 48 bp_activity_set_action( 49 $profile_id, 37 buddypress()->profile->id, 50 38 'updated_profile', 51 39 __( 'Updated Profile', 'buddypress' ), … … 78 66 79 67 return apply_filters( 'bp_xprofile_format_activity_action_new_avatar', $action, $activity ); 80 }81 82 /**83 * Format 'new_member' activity actions.84 *85 * @since BuddyPress (2.0.0)86 *87 * @param string $action Static activity action.88 * @param object $activity Activity object.89 * @return string90 */91 function bp_xprofile_format_activity_action_new_member( $action, $activity ) {92 $userlink = bp_core_get_userlink( $activity->user_id );93 $action = sprintf( __( '%s became a registered member', 'buddypress' ), $userlink );94 95 // Legacy filter - pass $user_id instead of $activity96 if ( has_filter( 'bp_core_activity_registered_member_action' ) ) {97 $action = apply_filters( 'bp_core_activity_registered_member_action', $action, $activity->user_id );98 }99 100 return apply_filters( 'bp_xprofile_format_activity_action_new_member', $action, $activity );101 68 } 102 69 -
trunk/tests/phpunit/testcases/xprofile/activity.php
r9139 r9273 294 294 /** 295 295 * @group activity_action 296 * @group bp_xprofile_format_activity_action_new_member297 */298 public function test_bp_xprofile_format_activity_action_new_member_xprofile_on() {299 $active = bp_is_active( 'xprofile' );300 buddypress()->active_components['xprofile'] = '1';301 302 $u = $this->factory->user->create();303 $a = $this->factory->activity->create( array(304 'component' => buddypress()->profile->id,305 'type' => 'new_member',306 'user_id' => $u,307 ) );308 309 $expected = sprintf( __( '%s became a registered member', 'buddypress' ), bp_core_get_userlink( $u ) );310 311 $a_obj = new BP_Activity_Activity( $a );312 313 $this->assertSame( $expected, $a_obj->action );314 315 if ( ! $active ) {316 unset( buddypress()->active_components['xprofile'] );317 }318 }319 320 /**321 * @group activity_action322 * @group bp_xprofile_format_activity_action_new_member323 */324 public function test_bp_xprofile_format_activity_action_new_member_xprofile_off() {325 $active = bp_is_active( 'xprofile' );326 unset( buddypress()->active_components['xprofile'] );327 328 $u = $this->factory->user->create();329 $a = $this->factory->activity->create( array(330 'component' => buddypress()->profile->id,331 'type' => 'new_member',332 'user_id' => $u,333 ) );334 335 $expected = sprintf( __( '%s became a registered member', 'buddypress' ), bp_core_get_userlink( $u ) );336 337 $a_obj = new BP_Activity_Activity( $a );338 339 $this->assertSame( $expected, $a_obj->action );340 341 if ( $active ) {342 buddypress()->active_components['xprofile'] = '1';343 }344 }345 346 /**347 * @group activity_action348 296 * @group bp_xprofile_format_activity_action_updated_profile 349 297 */
Note: See TracChangeset
for help on using the changeset viewer.