Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Tenzing
/
Tz Tools
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
243e6882
authored
2015-02-27 11:20:34 -0500
by
Marty Penner
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Ensure the right language is used when sending notifications
1 parent
59f86b07
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
com/Notifications/Notifications.php
com/Notifications/Notifications.php
View file @
243e688
...
...
@@ -216,8 +216,8 @@ function send_triggered_notification($uid = 0, $trigger = 'NO_TRIGGER', $args =
/** @var \wpdb $wpdb */
global
$wpdb
;
// LANGTODO: get this from the user's preference. As it stands, if an admin triggers this, the notification will be in whatever language the admin is viewing the page as
$lang
=
ICL_LANGUAGE_CODE
;
$user
=
new
User\Account
(
$uid
);
$lang
=
$user
->
getPreferredLanguage
()
;
/** @var \StdClass $notification */
$notification
=
get_notification_by_trigger
(
$trigger
);
...
...
@@ -265,13 +265,11 @@ function send_triggered_notification($uid = 0, $trigger = 'NO_TRIGGER', $args =
}
elseif
(
$uid
==
0
&&
isset
(
$args
[
'email'
]))
{
$toEmail
=
$args
[
'email'
];
}
else
{
$user
=
new
User\Account
(
$uid
);
$email_address_preference
=
get_user_meta
(
$user
->
ID
,
'email_address_preference'
,
true
);
if
(
empty
(
$email_address_preference
))
{
$emailAddressPreference
=
get_user_meta
(
$user
->
ID
,
'email_address_preference'
,
true
);
if
(
empty
(
$emailAddressPreference
))
{
$toEmail
=
$user
->
user_email
;
}
else
{
$pp
=
strtolower
(
$email
_address_p
reference
)
.
'_'
;
$pp
=
strtolower
(
$email
AddressP
reference
)
.
'_'
;
$toEmail
=
get_user_meta
(
$user
->
ID
,
$pp
.
'email'
,
true
);
if
(
empty
(
$toEmail
))
{
...
...
Please
register
or
sign in
to post a comment