Changeset 4534
- Timestamp:
- 12/15/2016 06:33:13 AM (8 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions-registration.php
r4470 r4534 38 38 39 39 $user_id = wpmu_create_user( wp_slash( $user_login ), wp_generate_password(), wp_slash( $user_email ) ); 40 if ( ! $user_id || is_wp_error( $user_id )) {40 if ( ! $user_id ) { 41 41 wp_die( __( 'Error! Something went wrong with your registration. Try again?', 'wporg-login' ) ); 42 42 } … … 79 79 die(); 80 80 } 81 82 function wporg_login_save_profile_fields() { 83 if ( ! $_POST || empty( $_POST['user_fields'] ) ) { 84 return; 85 } 86 $fields = array( 'url', 'from', 'occ', 'interests' ); 87 88 foreach ( $fields as $field ) { 89 if ( isset( $_POST['user_fields'][ $field ] ) ) { 90 $value = sanitize_text_field( wp_unslash( $_POST['user_fields'][ $field ] ) ); 91 if ( 'url' == $field ) { 92 wp_update_user( array( 93 'ID' => get_current_user_id(), 94 'user_url' => esc_url_raw( $value ) 95 ) ); 96 } else { 97 update_user_meta( $user->ID, $field, $value ); 98 } 99 } 100 } 101 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/partials/register-profilefields.php
r4470 r4534 4 4 * 5 5 * This template expects that the global $user variable is set. 6 * This template also handles saving of the fields, not ideal, but does the job for now.7 6 * 8 7 * @package wporg-login … … 10 9 11 10 $fields = array( 12 'url' => '',13 'from' => '',14 'occ' => '',15 'interests' => '',11 'url' => wp_get_current_user()->user_url ?: '', 12 'from' => get_user_meta( get_current_user_id(), 'from', true ) ?: '', 13 'occ' => get_user_meta( get_current_user_id(), 'occ', true ) ?: '', 14 'interests' => get_user_meta( get_current_user_id(), 'interests', true ) ?: '', 16 15 ); 17 18 foreach ( array_keys( $fields ) as $field ) {19 if ( $_POST && isset( $_POST['user_fields'][ $field ] ) ) {20 $fields[ $field ] = sanitize_text_field( wp_unslash( $_POST['user_fields'][ $field ] ) );21 if ( 'url' == $field ) {22 wp_update_user( array(23 'ID' => get_current_user_id(),24 'user_url' => esc_url( $fields[ $field ] )25 ) );26 } else {27 update_user_meta( $user->ID, $field, $fields[ $field ] );28 }29 } else {30 $fields[ $field ] = ( 'url' === $field ) ? $user->user_url : get_user_meta( $user->ID, $field, true );31 }32 }33 16 34 17 ?> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/register-confirm.php
r4470 r4534 33 33 } elseif ( !empty( $_POST['user_pass'] ) ) { 34 34 $user_pass = wp_unslash( $_POST['user_pass'] ); 35 36 wporg_login_save_profile_fields(); 35 37 36 38 add_filter( 'send_email_change_email', '__return_false' ); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/register-profile.php
r4470 r4534 25 25 } 26 26 27 wporg_login_save_profile_fields(); 28 27 29 wp_enqueue_script( 'wporg-registration' ); 28 30
Note: See TracChangeset
for help on using the changeset viewer.