16 wp_die( __( 'Cheatin’ uh?' ) ); |
16 wp_die( __( 'Cheatin’ uh?' ) ); |
17 } |
17 } |
18 |
18 |
19 if ( is_multisite() ) { |
19 if ( is_multisite() ) { |
20 function admin_created_user_email( $text ) { |
20 function admin_created_user_email( $text ) { |
|
21 $roles = get_editable_roles(); |
|
22 $role = $roles[ $_REQUEST['role'] ]; |
21 /* translators: 1: Site name, 2: site URL, 3: role */ |
23 /* translators: 1: Site name, 2: site URL, 3: role */ |
22 return sprintf( __( 'Hi, |
24 return sprintf( __( 'Hi, |
23 You\'ve been invited to join \'%1$s\' at |
25 You\'ve been invited to join \'%1$s\' at |
24 %2$s with the role of %3$s. |
26 %2$s with the role of %3$s. |
25 If you do not want to join this site please ignore |
27 If you do not want to join this site please ignore |
26 this email. This invitation will expire in a few days. |
28 this email. This invitation will expire in a few days. |
27 |
29 |
28 Please click the following link to activate your user account: |
30 Please click the following link to activate your user account: |
29 %%s' ), get_bloginfo('name'), home_url(), esc_html( $_REQUEST[ 'role' ] ) ); |
31 %%s' ), get_bloginfo( 'name' ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ) ); |
30 } |
32 } |
31 add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' ); |
33 add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' ); |
32 |
34 |
33 function admin_created_user_subject( $text ) { |
35 function admin_created_user_subject( $text ) { |
34 return sprintf( __( '[%s] Your site invite' ), get_bloginfo( 'name' ) ); |
36 return sprintf( __( '[%s] Your site invite' ), get_bloginfo( 'name' ) ); |
70 add_existing_user_to_blog( array( 'user_id' => $user_id, 'role' => $_REQUEST[ 'role' ] ) ); |
72 add_existing_user_to_blog( array( 'user_id' => $user_id, 'role' => $_REQUEST[ 'role' ] ) ); |
71 $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' ); |
73 $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' ); |
72 } else { |
74 } else { |
73 $newuser_key = substr( md5( $user_id ), 0, 5 ); |
75 $newuser_key = substr( md5( $user_id ), 0, 5 ); |
74 add_option( 'new_user_' . $newuser_key, array( 'user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST[ 'role' ] ) ); |
76 add_option( 'new_user_' . $newuser_key, array( 'user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST[ 'role' ] ) ); |
|
77 |
|
78 $roles = get_editable_roles(); |
|
79 $role = $roles[ $_REQUEST['role'] ]; |
75 /* translators: 1: Site name, 2: site URL, 3: role, 4: activation URL */ |
80 /* translators: 1: Site name, 2: site URL, 3: role, 4: activation URL */ |
76 $message = __( 'Hi, |
81 $message = __( 'Hi, |
77 |
82 |
78 You\'ve been invited to join \'%1$s\' at |
83 You\'ve been invited to join \'%1$s\' at |
79 %2$s with the role of %3$s. |
84 %2$s with the role of %3$s. |
80 |
85 |
81 Please click the following link to confirm the invite: |
86 Please click the following link to confirm the invite: |
82 %4$s' ); |
87 %4$s' ); |
83 wp_mail( $new_user_email, sprintf( __( '[%s] Joining confirmation' ), get_option( 'blogname' ) ), sprintf($message, get_option('blogname'), home_url(), $_REQUEST[ 'role' ], home_url("/newbloguser/$newuser_key/"))); |
88 wp_mail( $new_user_email, sprintf( __( '[%s] Joining confirmation' ), get_option( 'blogname' ) ), sprintf( $message, get_option( 'blogname' ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ), home_url( "/newbloguser/$newuser_key/" ) ) ); |
84 $redirect = add_query_arg( array('update' => 'add'), 'user-new.php' ); |
89 $redirect = add_query_arg( array('update' => 'add'), 'user-new.php' ); |
85 } |
90 } |
86 } |
91 } |
87 wp_redirect( $redirect ); |
92 wp_redirect( $redirect ); |
88 die(); |
93 die(); |
120 if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { |
125 if ( isset( $_POST[ 'noconfirmation' ] ) && is_super_admin() ) { |
121 $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' ] ) ); |
126 $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' ] ) ); |
122 wpmu_activate_signup( $key ); |
127 wpmu_activate_signup( $key ); |
123 $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' ); |
128 $redirect = add_query_arg( array('update' => 'addnoconfirmation'), 'user-new.php' ); |
124 } else { |
129 } else { |
125 $redirect = add_query_arg( array('update' => 'newuserconfimation'), 'user-new.php' ); |
130 $redirect = add_query_arg( array('update' => 'newuserconfirmation'), 'user-new.php' ); |
126 } |
131 } |
127 wp_redirect( $redirect ); |
132 wp_redirect( $redirect ); |
128 die(); |
133 die(); |
129 } |
134 } |
130 } |
135 } |
187 |
192 |
188 if ( isset($_GET['update']) ) { |
193 if ( isset($_GET['update']) ) { |
189 $messages = array(); |
194 $messages = array(); |
190 if ( is_multisite() ) { |
195 if ( is_multisite() ) { |
191 switch ( $_GET['update'] ) { |
196 switch ( $_GET['update'] ) { |
192 case "newuserconfimation": |
197 case "newuserconfirmation": |
193 $messages[] = __('Invitation email sent to new user. A confirmation link must be clicked before their account is created.'); |
198 $messages[] = __('Invitation email sent to new user. A confirmation link must be clicked before their account is created.'); |
194 break; |
199 break; |
195 case "add": |
200 case "add": |
196 $messages[] = __('Invitation email sent to user. A confirmation link must be clicked for them to be added to your site.'); |
201 $messages[] = __('Invitation email sent to user. A confirmation link must be clicked for them to be added to your site.'); |
197 break; |
202 break; |
260 } else { |
265 } else { |
261 _e( 'Enter the email address or username of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ); |
266 _e( 'Enter the email address or username of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ); |
262 $label = __('E-mail or Username'); |
267 $label = __('E-mail or Username'); |
263 } |
268 } |
264 ?> |
269 ?> |
265 <form action="" method="post" name="adduser" id="adduser" class="add:users: validate"<?php do_action('user_new_form_tag');?>> |
270 <form action="" method="post" name="adduser" id="adduser" class="validate"<?php do_action('user_new_form_tag');?>> |
266 <input name="action" type="hidden" value="adduser" /> |
271 <input name="action" type="hidden" value="adduser" /> |
267 <?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?> |
272 <?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?> |
268 |
273 |
269 <table class="form-table"> |
274 <table class="form-table"> |
270 <tr class="form-field form-required"> |
275 <tr class="form-field form-required"> |
293 if ( current_user_can( 'create_users') ) { |
298 if ( current_user_can( 'create_users') ) { |
294 if ( $do_both ) |
299 if ( $do_both ) |
295 echo '<h3 id="create-new-user">' . __( 'Add New User' ) . '</h3>'; |
300 echo '<h3 id="create-new-user">' . __( 'Add New User' ) . '</h3>'; |
296 ?> |
301 ?> |
297 <p><?php _e('Create a brand new user and add it to this site.'); ?></p> |
302 <p><?php _e('Create a brand new user and add it to this site.'); ?></p> |
298 <form action="" method="post" name="createuser" id="createuser" class="add:users: validate"<?php do_action('user_new_form_tag');?>> |
303 <form action="" method="post" name="createuser" id="createuser" class="validate"<?php do_action('user_new_form_tag');?>> |
299 <input name="action" type="hidden" value="createuser" /> |
304 <input name="action" type="hidden" value="createuser" /> |
300 <?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ) ?> |
305 <?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ) ?> |
301 <?php |
306 <?php |
302 // Load up the passed data, else set to a default. |
307 // Load up the passed data, else set to a default. |
303 foreach ( array( 'user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname', |
308 foreach ( array( 'user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname', |