57 403 |
57 403 |
58 ); |
58 ); |
59 } |
59 } |
60 |
60 |
61 // Adding an existing user to this blog. |
61 // Adding an existing user to this blog. |
62 $new_user_email = $user_details->user_email; |
62 $new_user_email = array(); |
63 $redirect = 'user-new.php'; |
63 $redirect = 'user-new.php'; |
64 $username = $user_details->user_login; |
64 $username = $user_details->user_login; |
65 $user_id = $user_details->ID; |
65 $user_id = $user_details->ID; |
66 if ( null != $username && array_key_exists( $blog_id, get_blogs_of_user( $user_id ) ) ) { |
66 if ( null != $username && array_key_exists( $blog_id, get_blogs_of_user( $user_id ) ) ) { |
67 $redirect = add_query_arg( array( 'update' => 'addexisting' ), 'user-new.php' ); |
67 $redirect = add_query_arg( array( 'update' => 'addexisting' ), 'user-new.php' ); |
98 |
98 |
99 $roles = get_editable_roles(); |
99 $roles = get_editable_roles(); |
100 $role = $roles[ $_REQUEST['role'] ]; |
100 $role = $roles[ $_REQUEST['role'] ]; |
101 |
101 |
102 /** |
102 /** |
103 * Fires immediately after a user is invited to join a site, but before the notification is sent. |
103 * Fires immediately after an existing user is invited to join the site, but before the notification is sent. |
104 * |
104 * |
105 * @since 4.4.0 |
105 * @since 4.4.0 |
106 * |
106 * |
107 * @param int $user_id The invited user's ID. |
107 * @param int $user_id The invited user's ID. |
108 * @param array $role Array containing role information for the invited user. |
108 * @param array $role Array containing role information for the invited user. |
121 |
121 |
122 Please click the following link to confirm the invite: |
122 Please click the following link to confirm the invite: |
123 %4$s' |
123 %4$s' |
124 ); |
124 ); |
125 |
125 |
|
126 $new_user_email['to'] = $user_details->user_email; |
|
127 $new_user_email['subject'] = sprintf( |
|
128 /* translators: Joining confirmation notification email subject. %s: Site title. */ |
|
129 __( '[%s] Joining Confirmation' ), |
|
130 wp_specialchars_decode( get_option( 'blogname' ) ) |
|
131 ); |
|
132 $new_user_email['message'] = sprintf( |
|
133 $message, |
|
134 get_option( 'blogname' ), |
|
135 home_url(), |
|
136 wp_specialchars_decode( translate_user_role( $role['name'] ) ), |
|
137 home_url( "/newbloguser/$newuser_key/" ) |
|
138 ); |
|
139 $new_user_email['headers'] = ''; |
|
140 |
|
141 /** |
|
142 * Filters the contents of the email sent when an existing user is invited to join the site. |
|
143 * |
|
144 * @since 5.6.0 |
|
145 * |
|
146 * @param array $new_user_email { |
|
147 * Used to build wp_mail(). |
|
148 * |
|
149 * @type string $to The email address of the invited user. |
|
150 * @type string $subject The subject of the email. |
|
151 * @type string $message The content of the email. |
|
152 * @type string $headers Headers. |
|
153 * } |
|
154 * @param int $user_id The invited user's ID. |
|
155 * @param array $role Array containing role information for the invited user. |
|
156 * @param string $newuser_key The key of the invitation. |
|
157 * |
|
158 */ |
|
159 $new_user_email = apply_filters( 'invited_user_email', $new_user_email, $user_id, $role, $newuser_key ); |
|
160 |
126 wp_mail( |
161 wp_mail( |
127 $new_user_email, |
162 $new_user_email['to'], |
128 sprintf( |
163 $new_user_email['subject'], |
129 /* translators: Joining confirmation notification email subject. %s: Site title. */ |
164 $new_user_email['message'], |
130 __( '[%s] Joining Confirmation' ), |
165 $new_user_email['headers'] |
131 wp_specialchars_decode( get_option( 'blogname' ) ) |
|
132 ), |
|
133 sprintf( |
|
134 $message, |
|
135 get_option( 'blogname' ), |
|
136 home_url(), |
|
137 wp_specialchars_decode( translate_user_role( $role['name'] ) ), |
|
138 home_url( "/newbloguser/$newuser_key/" ) |
|
139 ) |
|
140 ); |
166 ); |
141 |
167 |
142 if ( $switched_locale ) { |
168 if ( $switched_locale ) { |
143 restore_previous_locale(); |
169 restore_previous_locale(); |
144 } |
170 } |
532 <span class="description hide-if-js"><?php _e( '(required)' ); ?></span> |
558 <span class="description hide-if-js"><?php _e( '(required)' ); ?></span> |
533 </label> |
559 </label> |
534 </th> |
560 </th> |
535 <td> |
561 <td> |
536 <input class="hidden" value=" " /><!-- #24364 workaround --> |
562 <input class="hidden" value=" " /><!-- #24364 workaround --> |
537 <button type="button" class="button wp-generate-pw hide-if-no-js"><?php _e( 'Show password' ); ?></button> |
563 <button type="button" class="button wp-generate-pw hide-if-no-js"><?php _e( 'Generate password' ); ?></button> |
538 <div class="wp-pwd hide-if-js"> |
564 <div class="wp-pwd"> |
539 <?php $initial_password = wp_generate_password( 24 ); ?> |
565 <?php $initial_password = wp_generate_password( 24 ); ?> |
540 <span class="password-input-wrapper"> |
566 <span class="password-input-wrapper"> |
541 <input type="password" name="pass1" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" /> |
567 <input type="password" name="pass1" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" /> |
542 </span> |
568 </span> |
543 <button type="button" class="button wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>"> |
569 <button type="button" class="button wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>"> |
544 <span class="dashicons dashicons-hidden" aria-hidden="true"></span> |
570 <span class="dashicons dashicons-hidden" aria-hidden="true"></span> |
545 <span class="text"><?php _e( 'Hide' ); ?></span> |
571 <span class="text"><?php _e( 'Hide' ); ?></span> |
546 </button> |
572 </button> |
547 <button type="button" class="button wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Cancel password change' ); ?>"> |
|
548 <span class="dashicons dashicons-no" aria-hidden="true"></span> |
|
549 <span class="text"><?php _e( 'Cancel' ); ?></span> |
|
550 </button> |
|
551 <div style="display:none" id="pass-strength-result" aria-live="polite"></div> |
573 <div style="display:none" id="pass-strength-result" aria-live="polite"></div> |
552 </div> |
574 </div> |
553 </td> |
575 </td> |
554 </tr> |
576 </tr> |
555 <tr class="form-field form-required user-pass2-wrap hide-if-js"> |
577 <tr class="form-field form-required user-pass2-wrap hide-if-js"> |
556 <th scope="row"><label for="pass2"><?php _e( 'Repeat Password' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th> |
578 <th scope="row"><label for="pass2"><?php _e( 'Repeat Password' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th> |
557 <td> |
579 <td> |
558 <input name="pass2" type="password" id="pass2" autocomplete="off" /> |
580 <input name="pass2" type="password" id="pass2" autocomplete="off" aria-describedby="pass2-desc" /> |
|
581 <p class="description" id="pass2-desc"><?php _e( 'Type the password again.' ); ?></p> |
559 </td> |
582 </td> |
560 </tr> |
583 </tr> |
561 <tr class="pw-weak"> |
584 <tr class="pw-weak"> |
562 <th><?php _e( 'Confirm Password' ); ?></th> |
585 <th><?php _e( 'Confirm Password' ); ?></th> |
563 <td> |
586 <td> |
579 <tr class="form-field"> |
602 <tr class="form-field"> |
580 <th scope="row"><label for="role"><?php _e( 'Role' ); ?></label></th> |
603 <th scope="row"><label for="role"><?php _e( 'Role' ); ?></label></th> |
581 <td><select name="role" id="role"> |
604 <td><select name="role" id="role"> |
582 <?php |
605 <?php |
583 if ( ! $new_user_role ) { |
606 if ( ! $new_user_role ) { |
584 $new_user_role = ! empty( $current_role ) ? $current_role : get_option( 'default_role' ); |
607 $new_user_role = get_option( 'default_role' ); |
585 } |
608 } |
586 wp_dropdown_roles( $new_user_role ); |
609 wp_dropdown_roles( $new_user_role ); |
587 ?> |
610 ?> |
588 </select> |
611 </select> |
589 </td> |
612 </td> |