Changeset 1655 for trunk/bp-core/bp-core-activation.php
- Timestamp:
- 08/13/2009 01:24:21 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/bp-core/bp-core-activation.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-activation.php
r1636 r1655 1 1 <?php 2 // New activation code here next week. 2 3 function bp_core_screen_activation() { 4 global $bp, $wpdb; 5 6 if ( BP_ACTIVATION_SLUG != $bp->current_component ) 7 return false; 8 9 /* Check if an activation key has been passed */ 10 if ( isset( $_GET['key'] ) ) { 11 12 require_once( ABSPATH . WPINC . '/registration.php' ); 13 14 /* Activate the signup */ 15 $signup = apply_filters( 'bp_core_activate_account', wpmu_activate_signup( $_GET['key'] ) ); 16 17 /* If there was errors, add a message and redirect */ 18 if ( $signup->errors ) { 19 bp_core_add_message( __( 'There was an error activating your account, please try again.', 'buddypress' ), 'error' ); 20 bp_core_redirect( $bp->root_domain . '/' . BP_ACTIVATION_SLUG ); 21 } 22 23 /* Set the password */ 24 if ( !empty( $signup['meta']['password'] ) ) 25 $wpdb->update( $wpdb->users, array( 'user_pass' => $signup['meta']['password'] ), array( 'ID' => $signup['user_id'] ), array( '%s' ), array( '%d' ) ); 26 27 /* Set any profile data */ 28 if ( function_exists( 'xprofile_set_field_data' ) ) { 29 30 if ( !empty( $signup['meta']['profile_field_ids'] ) ) { 31 $profile_field_ids = explode( ',', $signup['meta']['profile_field_ids'] ); 32 33 foreach( $profile_field_ids as $field_id ) { 34 $current_field = $signup['meta']["field_{$field_id}"]; 35 36 if ( !empty( $current_field ) ) 37 xprofile_set_field_data( $field_id, $signup['user_id'], $current_field ); 38 } 39 } 40 41 } 42 43 /* Check for an uploaded avatar and move that to the correct user folder */ 44 $hashed_key = wp_hash( $_GET['key'] ); 45 46 /* Check if the avatar folder exists. If it does, move rename it, move it and delete the signup avatar dir */ 47 if ( file_exists( WP_CONTENT_DIR . '/blogs.dir/' . BP_ROOT_BLOG . '/files/avatars/signups/' . $hashed_key ) ) { 48 @rename( WP_CONTENT_DIR . '/blogs.dir/' . BP_ROOT_BLOG . '/files/avatars/signups/' . $hashed_key, WP_CONTENT_DIR . '/blogs.dir/' . BP_ROOT_BLOG . '/files/avatars/' . $signup['user_id'] ); 49 } 50 51 do_action( 'bp_core_account_activated', &$signup, $_GET['key'] ); 52 bp_core_add_message( __( 'Your account is now active!', 'buddypress' ) ); 53 54 $bp->activation_complete = true; 55 } 56 57 bp_core_load_template( 'registration/activate' ); 58 } 59 add_action( 'wp', 'bp_core_screen_activation', 3 ); 60 3 61 ?>
Note: See TracChangeset
for help on using the changeset viewer.