Skip to content

Commit

Permalink
Switch to user language for the password reset email. Might want to d…
Browse files Browse the repository at this point in the history
…o this for all emails.
  • Loading branch information
brianhogg committed Feb 14, 2025
1 parent 8bcf24d commit d151a78
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions includes/emails/class.llms.email.reset.password.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,20 @@ public function init( $args = array() ) {

$this->add_recipient( $args['user']->ID );

$original_locale = get_locale();
$locale = get_user_locale( $args['user']->ID );
if ( $locale && $locale !== $original_locale ) {
switch_to_locale( $locale );
}

$this->body = $this->get_body_content( $args );
$this->subject = __( 'Password Reset for {site_title}', 'lifterlms' );
$this->heading = __( 'Reset Your Password', 'lifterlms' );

if ( $locale && $locale !== $original_locale ) {
restore_previous_locale();
}

$this->add_merge_data(
array(
'{user_login}' => $args['login_display'],
Expand All @@ -47,9 +57,7 @@ public function init( $args = array() ) {
* Custom content for the password reset email
*
* @param array $data associative array of user related data for the email to be sent
* @return void
* @since 3.8.0
* @version 3.8.0
*/
public function get_body_content( $data ) {

Expand Down

0 comments on commit d151a78

Please sign in to comment.