From 5ac8a32840e4fd0e5f7f48da489e16dd400be432 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 24 Jul 2012 17:32:40 +0000 Subject: [PATCH] Translate role names in the new user notification email. Props obenland. fixes #20764 git-svn-id: http://core.svn.wordpress.org/trunk@21316 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/user-new.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wp-admin/user-new.php b/wp-admin/user-new.php index 3119eb5720..f6f1dcb094 100644 --- a/wp-admin/user-new.php +++ b/wp-admin/user-new.php @@ -18,6 +18,8 @@ if ( is_multisite() ) { if ( is_multisite() ) { 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 @@ -26,7 +28,7 @@ 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(), esc_html( $_REQUEST[ 'role' ] ) ); +%%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' ); @@ -72,6 +74,9 @@ if ( isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action'] ) { } else { $newuser_key = substr( md5( $user_id ), 0, 5 ); add_option( 'new_user_' . $newuser_key, array( 'user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST[ 'role' ] ) ); + + $roles = get_editable_roles(); + $role = $roles[ $_REQUEST['role'] ]; /* translators: 1: Site name, 2: site URL, 3: role, 4: activation URL */ $message = __( 'Hi, @@ -80,7 +85,7 @@ You\'ve been invited to join \'%1$s\' at Please click the following link to confirm the invite: %4$s' ); - 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/"))); + 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/" ) ) ); $redirect = add_query_arg( array('update' => 'add'), 'user-new.php' ); } }