Move 2 ad hoc user admin functions:

* Move `use_ssl_preference()` from `wp-admin/user-edit.php` to `wp-admin/includes/user.php`.
* Move `admin_created_user_email()` from `wp-admin/user-new.php` to `wp-admin/includes/user.php`.

See #33813.


git-svn-id: https://develop.svn.wordpress.org/trunk@34021 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-09-10 21:32:46 +00:00
parent d7670b6a38
commit 96a40d6102
3 changed files with 35 additions and 34 deletions

View File

@ -465,3 +465,38 @@ jQuery(document).ready( function($) {
</script>
<?php
}
/**
* Optional SSL preference that can be turned on by hooking to the 'personal_options' action.
*
* @since 2.7.0
*
* @param object $user User data object
*/
function use_ssl_preference($user) {
?>
<tr class="user-use-ssl-wrap">
<th scope="row"><?php _e('Use https')?></th>
<td><label for="use_ssl"><input name="use_ssl" type="checkbox" id="use_ssl" value="1" <?php checked('1', $user->use_ssl); ?> /> <?php _e('Always use https when visiting the admin'); ?></label></td>
</tr>
<?php
}
/**
*
* @param string $text
* @return string
*/
function admin_created_user_email( $text ) {
$roles = get_editable_roles();
$role = $roles[ $_REQUEST['role'] ];
/* translators: 1: Site name, 2: site URL, 3: role */
return sprintf( __( 'Hi,
You\'ve been invited to join \'%1$s\' at
%2$s with the role of %3$s.
If you do not want to join this site please ignore
this email. This invitation will expire in a few days.
Please click the following link to activate your user account:
%%s' ), get_bloginfo( 'name' ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ) );
}

View File

@ -59,22 +59,6 @@ $wp_http_referer = remove_query_arg(array('update', 'delete_count'), $wp_http_re
$user_can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' );
/**
* Optional SSL preference that can be turned on by hooking to the 'personal_options' action.
*
* @since 2.7.0
*
* @param object $user User data object
*/
function use_ssl_preference($user) {
?>
<tr class="user-use-ssl-wrap">
<th scope="row"><?php _e('Use https')?></th>
<td><label for="use_ssl"><input name="use_ssl" type="checkbox" id="use_ssl" value="1" <?php checked('1', $user->use_ssl); ?> /> <?php _e('Always use https when visiting the admin'); ?></label></td>
</tr>
<?php
}
/**
* Filter whether to allow administrators on Multisite to edit every user.
*

View File

@ -26,24 +26,6 @@ if ( is_multisite() ) {
}
if ( is_multisite() ) {
/**
*
* @param string $text
* @return string
*/
function admin_created_user_email( $text ) {
$roles = get_editable_roles();
$role = $roles[ $_REQUEST['role'] ];
/* translators: 1: Site name, 2: site URL, 3: role */
return sprintf( __( 'Hi,
You\'ve been invited to join \'%1$s\' at
%2$s with the role of %3$s.
If you do not want to join this site please ignore
this email. This invitation will expire in a few days.
Please click the following link to activate your user account:
%%s' ), get_bloginfo( 'name' ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ) );
}
add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' );
}