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
2a58ec97
authored
2015-11-30 14:49:29 -0500
by
Insu Mun
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Implement the email template into triggered notification as well.
1 parent
6a04a1d0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
com/Notifications/Notifications.php
com/Notifications/Notifications.php
View file @
2a58ec9
...
...
@@ -305,6 +305,66 @@ function send_triggered_notification($uid = 0, $trigger = 'NO_TRIGGER', $args =
}
}
// Do argument template again
// Set arguments for email template
$user_data
=
[
'prefix'
,
'description'
,
'date_of_birth'
,
'title'
,
'first_name'
,
'initial'
,
'last_name'
,
'degrees'
,
'designations'
,
'company'
,
'company_type'
,
'home_address'
,
'home_address2'
,
'home_city'
,
'home_province'
,
'home_country'
,
'home_postal'
,
'home_phone'
,
'home_mobile'
,
'home_email'
,
'work_address'
,
'work_address2'
,
'work_city'
,
'work_province'
,
'work_country'
,
'work_postal'
,
'work_phone'
,
'work_extension'
,
'work_fax'
,
'work_email'
,
'website'
,
'preferred_language'
,
'email_address_preference'
,
'preferred_email'
,
'member_id'
];
$user_data
=
array_flip
(
$user_data
);
foreach
(
$user_data
as
$field
=>
$value
)
{
$user_data
[
$field
]
=
User\clean_string
(
get_user_meta
(
$uid
,
$field
,
true
));
if
(
$field
==
'preferred_email'
)
{
$user_data
[
'preferred_email'
]
=
$user_data
[
'email_address_preference'
]
==
'Home'
?
$user_data
[
'home_email'
]
:
$user_data
[
'work_email'
];
}
}
foreach
(
$user_data
as
$key
=>
$val
)
{
if
((
filter_var
(
$val
,
FILTER_VALIDATE_URL
)
!==
false
)
&&
!
empty
(
$html
))
{
$html
=
str_replace
(
'{'
.
$key
.
'}'
,
'<a href="'
.
$val
.
'">'
.
$val
.
'</a>'
,
$html
);
}
else
{
$html
=
str_replace
(
'{'
.
$key
.
'}'
,
$val
,
$html
);
$altText
=
str_replace
(
'{'
.
$key
.
'}'
,
$val
,
$altText
);
$subject
=
str_replace
(
'{'
.
$key
.
'}'
,
$val
,
$subject
);
}
}
$attachments
=
isset
(
$contents
[
$lang
.
'_attachments'
])
?
$contents
[
$lang
.
'_attachments'
]
:
$contents
[
'en_attachments'
];
...
...
Please
register
or
sign in
to post a comment