Make WordPress Core


Ignore:
Timestamp:
09/14/2005 12:03:02 AM (20 years ago)
Author:
ryan
Message:

User create/update rework. Introduce wp_insert_user(), wp_create_user(), wp_update_user(), add_user(), update_user(), wp_new_user_notification().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/profile-update.php

    r2845 r2872  
    55check_admin_referer();
    66
    7 if ( empty($_POST['email']) )
    8     die (__("<strong>ERROR</strong>: please type your e-mail address"));
    9 elseif ( !is_email($_POST['email']) )
    10     die (__("<strong>ERROR</strong>: the e-mail address isn't correct"));
     7$errors = update_user($user_ID);
    118
    12 $pass1 = $_POST['pass1'];
    13 $pass2 = $_POST['pass2'];
    14 do_action('check_passwords', array($user_login, &$pass1, &$pass2));
    15 
    16 if ( '' == $pass1 ) {
    17     if ( '' != $pass2 )
    18         die (__('<strong>ERROR</strong>: you typed your new password only once. Go back to type it twice.'));
    19     $updatepassword = '';
    20 } else {
    21     if ('' == $pass2)
    22         die (__('<strong>ERROR</strong>: you typed your new password only once. Go back to type it twice.'));
    23     if ( $pass1 != $pass2 )
    24         die (__('<strong>ERROR</strong>: you typed two different passwords. Go back to correct that.'));
    25     $newuser_pass = $pass1;
    26     $updatepassword = "user_pass=MD5('$newuser_pass'), ";
    27     wp_clearcookie();
    28     wp_setcookie($user_login, $newuser_pass);
     9if (count($errors) != 0) {
     10    foreach ($errors as $id => $error) {
     11        echo $error . '<br/>';
     12    }
     13    exit;
    2914}
    30 
    31 $first_name = wp_specialchars($_POST['first_name']);
    32 $last_name = wp_specialchars($_POST['last_name']);
    33 $display_name = wp_specialchars($_POST['display_name']);
    34 $nickname = $_POST['nickname'];
    35 $nicename = sanitize_title($nickname);
    36 $jabber = wp_specialchars($_POST['jabber']);
    37 $aim = wp_specialchars($_POST['aim']);
    38 $yim = wp_specialchars($_POST['yim']);
    39 $email = wp_specialchars($_POST['email']);
    40 $url = wp_specialchars($_POST['url']);
    41 $url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $url) ? $url : 'http://' . $url;
    42 $user_description = $_POST['user_description'];
    43 
    44 $result = $wpdb->query("UPDATE $wpdb->users SET $updatepassword user_email='$email', user_url='$url', user_nicename = '$nicename', display_name = '$display_name' WHERE ID = '$user_ID'");
    45 
    46 update_usermeta( $user_ID, 'first_name', $first_name );
    47 update_usermeta( $user_ID, 'last_name', $last_name );
    48 update_usermeta( $user_ID, 'nickname', $nickname );
    49 update_usermeta( $user_ID, 'description', $user_description );
    50 update_usermeta( $user_ID, 'jabber', $jabber );
    51 update_usermeta( $user_ID, 'aim', $aim );
    52 update_usermeta( $user_ID, 'yim', $yim );
    53 
    54 do_action('profile_update', $user_ID);
    5515
    5616if ( 'profile' == $_POST['from'] )
Note: See TracChangeset for help on using the changeset viewer.