Make WordPress Core

Ticket #18163: 18163.2.patch

File 18163.2.patch, 7.5 KB (added by Mista-Flo, 9 years ago)

Add website url field

  • wp-admin/user-new.php

    diff --git wp-admin/user-new.php wp-admin/user-new.php
    index 38b78dd..443f899 100644
    Please click the following link to confirm the invite: 
    144144                                add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email
    145145                                add_filter( 'wpmu_welcome_user_notification', '__return_false' ); // Disable welcome email
    146146                        }
    147                         wpmu_signup_user( $new_user_login, $new_user_email, array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST['role'] ) );
     147                        $first_name = ( isset( $_REQUEST['first_name'] ) && ! empty( $_REQUEST['first_name'] ) ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '';
     148                        $last_name = ( isset( $_REQUEST['last_name'] ) && ! empty( $_REQUEST['last_name'] ) ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '';
     149                        $url = ( isset( $_REQUEST['url'] ) && ! empty( $_REQUEST['url'] ) ) ? esc_url( $_REQUEST['url'] ) : '';
     150                        wpmu_signup_user( $new_user_login, $new_user_email, array(
     151                                'add_to_blog' => $wpdb->blogid,
     152                                'new_role'        => $_REQUEST['role'],
     153                                'first_name'  => $first_name,
     154                                'last_name'   => $last_name,
     155                                'url'             => $url,
     156                        ));
    148157                        if ( isset( $_POST[ 'noconfirmation' ] ) && current_user_can( 'manage_network_users' ) ) {
    149158                                $key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $new_user_email ) );
    150159                                $new_user = wpmu_activate_signup( $key );
    $new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unsl 
    399408                <th scope="row"><label for="email"><?php _e('Email'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
    400409                <td><input name="email" type="email" id="email" value="<?php echo esc_attr( $new_user_email ); ?>" /></td>
    401410        </tr>
    402 <?php if ( !is_multisite() ) { ?>
    403411        <tr class="form-field">
    404412                <th scope="row"><label for="first_name"><?php _e('First Name') ?> </label></th>
    405                 <td><input name="first_name" type="text" id="first_name" value="<?php echo esc_attr($new_user_firstname); ?>" /></td>
     413                <td><input name="first_name" type="text" id="first_name" value="<?php echo esc_attr( $new_user_firstname ); ?>" /></td>
    406414        </tr>
    407415        <tr class="form-field">
    408416                <th scope="row"><label for="last_name"><?php _e('Last Name') ?> </label></th>
    409                 <td><input name="last_name" type="text" id="last_name" value="<?php echo esc_attr($new_user_lastname); ?>" /></td>
     417                <td><input name="last_name" type="text" id="last_name" value="<?php echo esc_attr( $new_user_lastname ); ?>" /></td>
    410418        </tr>
    411419        <tr class="form-field">
    412420                <th scope="row"><label for="url"><?php _e('Website') ?></label></th>
    413421                <td><input name="url" type="url" id="url" class="code" value="<?php echo esc_attr( $new_user_uri ); ?>" /></td>
    414422        </tr>
     423<?php if ( ! is_multisite() ) { ?>
    415424        <tr class="form-field form-required user-pass1-wrap">
    416425                <th scope="row">
    417426                        <label for="pass1">
  • wp-includes/ms-functions.php

    diff --git wp-includes/ms-functions.php wp-includes/ms-functions.php
    index ca81761..1edf8bd 100644
    function wpmu_activate_signup($key) { 
    988988                if ( isset( $user_already_exists ) )
    989989                        return new WP_Error( 'user_already_exists', __( 'That username is already activated.' ), $signup);
    990990
     991                if ( ! empty( $meta['first_name'] ) ) {
     992                        update_user_meta( $user_id, 'first_name', $meta['first_name'] );
     993                }
     994
     995                if ( ! empty( $meta['last_name'] ) ) {
     996                        update_user_meta( $user_id, 'last_name', $meta['last_name'] );
     997                }
     998
     999                if ( ! empty( $meta['url'] ) ) {
     1000                        wp_update_user( array( 'ID' => $user_id, 'user_url' => $meta['url'] ) );
     1001                }
     1002               
    9911003                /**
    9921004                 * Fires immediately after a new user is activated.
    9931005                 *