-
Notifications
You must be signed in to change notification settings - Fork 139
Expand file tree
/
Copy pathclass.llms.email.reset.password.php
More file actions
83 lines (71 loc) · 1.65 KB
/
class.llms.email.reset.password.php
File metadata and controls
83 lines (71 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/**
* LifterLMS Password Reset Email
*
* @package LifterLMS/Emails/Classes
*
* @since 1.0.0
* @version 3.8.0
*/
defined( 'ABSPATH' ) || exit;
/**
* LifterLMS Password Reset Email class
*
* @since 1.0.0
* @version 3.8.0
*/
class LLMS_Email_Reset_Password extends LLMS_Email {
protected $id = 'reset_password';
/**
* Initializer
*
* @param array $args associative array of user related data for the email to be sent
* @return void
* @since 3.8.0
* @version 3.8.0
*/
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'],
)
);
}
/**
* Custom content for the password reset email
*
* @param array $data associative array of user related data for the email to be sent
* @since 3.8.0
*/
public function get_body_content( $data ) {
$url = esc_url(
add_query_arg(
array(
'key' => $data['key'],
'login' => rawurlencode( $data['user']->user_login ),
),
wp_lostpassword_url()
)
);
ob_start();
llms_get_template(
'emails/reset-password.php',
array(
'url' => $url,
)
);
return ob_get_clean();
}
}