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
9ea0a7cb
authored
2011-02-15 19:53:17 +0000
by
Kevin Burton
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
updates to the notification system
1 parent
3c508f67
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
com/Notifications/Notifications.php
com/Notifications/Notifications.php
View file @
9ea0a7c
...
...
@@ -181,16 +181,10 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(),
$notification
=
get_notification_by_trigger
(
$trigger
);
if
(
$notification
)
{
// get the user and user details....
if
(
$uid
>
0
)
{
$user
=
new
WP_User
(
$uid
);
//Tools\getCurrentUser();
$notify_me
=
get_user_meta
(
$user
->
ID
,
'notify_me'
,
true
);
$notify_format
=
get_user_meta
(
$user
->
ID
,
'notify_format'
,
true
);
$email_preference
=
get_user_meta
(
$user
->
ID
,
'email_address_preference'
,
true
);
$cell
=
get_user_meta
(
$user
->
ID
,
'mobile'
,
true
);
}
// get the notification and notificatio details....
$nid
=
$notification
->
ID
;
...
...
@@ -205,6 +199,8 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(),
$notification
->
type
=
$details
[
'type'
];
$notification
->
sendto
=
$details
[
'sendto'
];
$notification
->
is_email
=
((
$email
[
'text'
]
!=
""
||
$email
[
'html'
]
!=
""
)
&&
$email
[
'subject'
]
!=
""
)
?
true
:
false
;
$notification
->
is_system
=
(
isset
(
$system
[
'message'
])
&&
$system
[
'message'
]
!=
""
)
?
true
:
false
;
$notification
->
is_sms
=
(
isset
(
$sms
[
'message'
])
&&
$sms
[
'message'
]
!=
""
)
?
true
:
false
;
...
...
@@ -241,26 +237,28 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(),
// if is_email ===========================================
if
(
$notification
->
is_email
)
{
send_email
(
$uid
,
$email
,
$args
);
}
send_email
(
$uid
,
$email
,
$args
,
true
);
}
}
// if the system notification has set current user than get current user otherwise loop through the users needed.
}
function
send_email
(
$uid
,
$contents
,
$args
)
{
$from_address
=
get_bloginfo
(
'admin_email'
);
function
send_email
(
$uid
=
0
,
$contents
,
$args
,
$override
=
false
)
{
if
(
$uid
==
0
&&
!
isset
(
$args
[
'email'
]))
{
return
;
}
if
(
$uid
>
0
)
{
$user
=
new
WP_User
(
$uid
);
$to_email
=
$user
->
user_email
;
//get_user_meta($uid,'home_email',true);
}
elseif
(
isset
(
$args
[
'email'
]))
{
$to_email
=
$args
[
'email'
];
if
(
isset
(
$args
[
'email'
]))
{
$to_email
=
$args
[
'email'
];
}
else
{
return
;
$user
=
new
WP_User
(
$uid
);
$to_email
=
$user
->
user_email
;
}
$from_address
=
get_bloginfo
(
'admin_email'
);
$subject
=
$contents
[
'subject'
];
$html
=
$contents
[
'html'
];
...
...
@@ -293,7 +291,9 @@ function send_email($uid, $contents,$args) {
// Additional headers
//$headers .= 'To: '.$to_email.' <'.$to_email.'>' . "\r\n";
$headers
.=
'From: CICBV <'
.
$from_address
.
'>'
.
"
\r\n
"
;
//die("To: $to_email, Subject: $subject, Message: $message, Header: $headers");
mail
(
$to_email
,
$subject
,
$message
,
$headers
);
...
...
Please
register
or
sign in
to post a comment