WordPress.org

Make WordPress Core

Ticket #15456: user-new-notices-fix.patch

File user-new-notices-fix.patch, 1.6 KB (added by wpdavis, 5 years ago)

Fixes sprintf to use single quotes, makes sure the user is submitting the multisite form before trying to add a user to the blog to avoid errors.

  • wp-admin/user-new.php

     
    1515if ( is_multisite() ) { 
    1616        function admin_created_user_email( $text ) { 
    1717                /* translators: 1: Site name, 2: site URL, 3: role */ 
    18                 return sprintf( __( "Hi, 
    19 You've been invited to join '%1$s' at 
     18                return sprintf( __( 'Hi, 
     19You\'ve been invited to join \'%1$s\' at 
    2020%2$s as a %3$s. 
    2121If you do not want to join this site please ignore 
    2222this email. This invitation will expire in a few days. 
    2323 
    2424Please click the following link to activate your user account: 
    25 %%s" ), get_bloginfo('name'), site_url(), esc_html( $_REQUEST[ 'role' ] ) ); 
     25%%s' ), get_bloginfo('name'), site_url(), esc_html( $_REQUEST[ 'role' ] ) ); 
    2626        } 
    2727        add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' ); 
    2828 
     
    108108                                add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email 
    109109                        } 
    110110                        wpmu_signup_user( $new_user_login, $_REQUEST[ 'email' ], array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST[ 'role' ] ) ); 
    111                         if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { 
     111                        if ( isset( $_POST[ 'adduser' ] ) && isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { 
    112112                                $key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $_REQUEST[ 'email' ] ) ); 
    113113                                wpmu_activate_signup( $key ); 
    114114                                $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' );