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
f24204bb
authored
2010-11-29 20:50:06 +0000
by
Kevin Burton
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
adjustment to sorting of the notifications array
1 parent
efc9aee7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
9 deletions
com/Notifications/Notifications.php
com/Notifications/Notifications.php
View file @
f24204b
...
...
@@ -21,10 +21,23 @@ const OPTION_NAME = "notif_options";
});
function
subval_sort
(
$a
,
$subkey
,
$sort
)
{
foreach
(
$a
as
$k
=>
$v
)
{
$b
[
$k
]
=
strtolower
(
$v
[
$subkey
]);
}
$sort
(
$b
);
foreach
(
$b
as
$key
=>
$val
)
{
$c
[]
=
$a
[
$key
];
}
return
$c
;
}
function
get_user_notices
(
$uid
)
{
$notices
=
get_user_meta
(
$uid
,
'notices'
,
true
);
$notices
=
get_user_meta
(
$uid
,
'notices'
,
true
);
if
(
!
empty
(
$notices
))
{
$notices
=
array_reverse
(
$notices
);
$notices
=
subval_sort
(
$notices
,
'sent_date'
,
arsort
);
Vars
::
$notices
=
$notices
;
}
}
...
...
@@ -32,6 +45,8 @@ function get_user_notices($uid) {
function
print_user_notices
(
$show_more
=
true
)
{
get_user_notices
(
Tools\getCurrentUser
()
->
ID
);
if
(
CBV\on_page
(
'/dashboard'
))
{
$limit
=
5
;
}
else
{
...
...
@@ -223,12 +238,8 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(),
send_email
(
$uid
,
$email
,
$args
,
$send_override
);
}
}
else
{
die
(
'no notification'
);
}
}
// if the system notification has set current user than get current user otherwise loop through the users needed.
}
...
...
@@ -237,7 +248,24 @@ function send_email($uid, $contents,$args) {
if
(
$uid
>
0
)
{
$user
=
new
WP_User
(
$uid
);
$to_email
=
$user
->
user_email
;
$preference
=
get_user_meta
(
$uid
,
'email_address_preference'
,
true
);
if
(
$preference
==
"Home"
)
{
$to_email
=
get_user_meta
(
$uid
,
'home_email'
,
true
);
}
elseif
(
$preference
==
"Work"
)
{
$to_email
=
get_user_meta
(
$uid
,
'company_email'
,
true
);
}
else
{
$to_email
=
$user
->
user_email
;
}
if
(
!
(
boolean
)
filter_var
(
$to_email
,
FILTER_VALIDATE_EMAIL
))
{
$to_email
=
$user
->
user_email
;
}
}
elseif
(
isset
(
$args
[
'email'
])
&&
!
empty
(
$args
[
'email'
]))
{
$to_email
=
$args
[
'email'
];
}
else
{
...
...
Please
register
or
sign in
to post a comment