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
a330b4c1
authored
2011-03-02 21:04:22 +0000
by
Kevin Burton
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
updates to the notification system and also added in life member for user admin
1 parent
712216f5
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
29 deletions
com/Notifications/Admin.php
com/Notifications/Notifications.php
com/Notifications/views/admin.php
com/Notifications/views/create.php
com/Notifications/views/form.php
com/UserManager/views/edit_user_overview.php
com/Notifications/Admin.php
View file @
a330b4c
...
...
@@ -105,6 +105,9 @@ function display_page() {
// SMS
$sms
=
""
;
update_post_meta
(
$id
,
'notif_type'
,
$type
);
update_post_meta
(
$id
,
'execute_date'
,
mysqldatetime_to_timestamp
(
$execute_date
));
update_post_meta
(
$id
,
"details"
,
array
(
'type'
=>
$type
,
'sendto'
=>
$sendto
...
...
@@ -113,6 +116,7 @@ function display_page() {
,
'execute_date'
=>
$execute_date
));
update_post_meta
(
$id
,
'send_status'
,
$entry
->
details
[
'status'
]);
if
(
count
(
$entry
->
email
[
'attachments'
]
)
>
0
)
{
$attachments
=
array_merge
(
$entry
->
email
[
'attachments'
],
$attachments
);
...
...
@@ -163,7 +167,7 @@ function display_page() {
if
(
isset
(
$_GET
[
'action'
])
&&
$_GET
[
'action'
]
==
"delete"
)
{
wp_delete_post
(
$_GET
[
'page_id'
],
true
);
}
elseif
(
isset
(
$_GET
[
'action'
])
&&
$_GET
[
'action'
]
==
"
delet
e"
)
{
}
elseif
(
isset
(
$_GET
[
'action'
])
&&
$_GET
[
'action'
]
==
"
archiv
e"
)
{
$id
=
$_GET
[
'page_id'
];
...
...
@@ -171,7 +175,7 @@ function display_page() {
$postdata
[
'status'
]
=
"archived"
;
update_post_meta
(
$id
,
'details'
,
$postdata
);
update_post_meta
(
$id
,
'send_status'
,
$postdata
[
'status'
]);
}
...
...
@@ -185,6 +189,9 @@ function display_page() {
,
'numberposts'
=>
-
1
,
'orderby'
=>
'modified'
,
'order'
=>
'desc'
,
'meta_key'
=>
'send_status'
,
'meta_compare'
=>
'='
,
'meta_value'
=>
'pending'
);
...
...
@@ -355,6 +362,9 @@ function create_notification() {
$id
=
wp_insert_post
(
$notification
);
update_post_meta
(
$id
,
'notif_type'
,
$type
);
update_post_meta
(
$id
,
'execute_date'
,
mysqldatetime_to_timestamp
(
$execute_date
));
add_post_meta
(
$id
,
"details"
,
array
(
'type'
=>
$type
,
'sendto'
=>
$sendto
...
...
@@ -363,6 +373,8 @@ function create_notification() {
,
'execute_date'
=>
$execute_date
));
update_post_meta
(
$id
,
'send_status'
,
'pending'
);
add_post_meta
(
$id
,
"email"
,
array
(
'subject'
=>
$subject
,
'text'
=>
$text
...
...
com/Notifications/Notifications.php
View file @
a330b4c
...
...
@@ -5,6 +5,7 @@ use Tz\Common;
use
Tz\WordPress\Tools
;
use
Tz\WordPress\Tools\Sequencer
;
use
Tz\WordPress\CBV
;
use
Tz\WordPress\CBV\User
;
use
WP_User
;
use
Exception
,
StdClass
;
...
...
@@ -34,18 +35,19 @@ function subval_sort($a,$subkey,$sort) {
}
function
get_user_notices
(
$uid
)
{
$notices
=
get_user_meta
(
$uid
,
'notices'
,
true
);
$notices
=
get_user_meta
(
$uid
,
'notices'
,
true
);
if
(
!
empty
(
$notices
))
{
$notices
=
subval_sort
(
$notices
,
'sent_date'
,
'arsort'
);
Vars
::
$notices
=
$notices
;
}
}
function
print_user_notices
(
$show_more
=
true
)
{
get_user_notices
(
Tools\getCurrentUser
()
->
ID
);
$user
=
new
User\CurrentAccount
();
get_user_notices
(
$user
->
ID
);
if
(
CBV\on_page
(
'/dashboard'
))
{
...
...
@@ -143,7 +145,9 @@ function get_notification_by_trigger($trigger) {
*/
function
get_num_notices
()
{
// get number of notices for this user that are new...
get_user_notices
(
Tools\getCurrentUser
()
->
ID
);
$user
=
new
User\CurrentAccount
();
get_user_notices
(
$user
->
ID
);
$notices
=
Vars
::
$notices
;
$notifications
=
array
();
// return $num;
...
...
@@ -191,29 +195,19 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(),
$details
=
get_post_meta
(
$nid
,
'details'
,
true
);
$email
=
get_post_meta
(
$nid
,
'email'
,
true
);
$system
=
get_post_meta
(
$nid
,
'system'
,
true
);
$sms
=
get_post_meta
(
$nid
,
'sms'
,
true
);
$notification
->
trigger
=
$details
[
'trigger'
];
$notification
->
status
=
isset
(
$details
[
'status'
])
?
$details
[
'status'
]
:
"active"
;
$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
;
// if is_sms =============================================
if
(
$notification
->
is_sms
&&
isset
(
$notify_me
)
&&
$notify_me
&&
isset
(
$cell
)
&&
!
empty
(
$cell
))
{
}
// if is_system ==========================================
if
(
$notification
->
is_system
&&
$uid
!=
0
)
{
get_user_notices
(
$u
ser
->
ID
);
get_user_notices
(
$u
id
);
$notices
=
Vars
::
$notices
;
$insert
=
array
(
...
...
@@ -231,7 +225,7 @@ function send_triggered_notification($uid,$trigger="NO_TRIGGER",$args = array(),
$notices
[
$sequence
]
=
$insert
;
update_user_meta
(
$u
ser
->
ID
,
'notices'
,
$notices
);
update_user_meta
(
$u
id
,
'notices'
,
$notices
);
}
...
...
com/Notifications/views/admin.php
View file @
a330b4c
...
...
@@ -35,7 +35,7 @@ print "</pre>";
</thead>
<tbody>
<?php
foreach
(
$notifications
[
'scheduled'
]
as
$entry
)
:
$sendto
=
$entry
->
sendto
;
if
(
is_numeric
(
$sendto
))
{
$sendto
=
Notifications\getGroups
(
$sendto
)
.
" Group"
;
...
...
@@ -52,12 +52,13 @@ print "</pre>";
<td>
<?php
if
(
$entry
->
is_system
)
:
?>
<img
src=
"
<?php
echo
Tools\url
(
'assets/images/accept.png'
,
__FILE__
)
?>
"
/>
<?php
endif
;
?>
</td>
<td>
<?php
if
(
strtotime
(
$entry
->
execute_date
)
>
time
())
:?>
<?php
if
(
strtotime
(
$entry
->
execute_date
)
>
time
())
:?>
<
a
href
=
"/wp-admin/admin.php?page=notifications&action=edit&page_id=<?php echo
$entry->ID
; ?>"
>
edit
</
a
>
|
<
a
href
=
"/wp-admin/admin.php?page=notifications&action=delete&page_id=<?php echo
$entry->ID
; ?>"
onclick
=
"return confirm('Are you sure?');"
>
delete
</
a
></
td
>
<?
php
else
:
?>
<
a
href=
"/wp-admin/admin.php?page=notifications&action=edit&page_id=
<?php
echo
$entry
->
ID
;
?>
"
>
edit
</a>
|
<a
href=
"/wp-admin/admin.php?page=notifications&action=archive&page_id=
<?php
echo
$entry
->
ID
;
?>
"
>
archive
</a
>
<
em>
In progress....
</em
>
<?php
endif
;
?>
</tr>
<?php
endforeach
;
?>
...
...
com/Notifications/views/create.php
View file @
a330b4c
...
...
@@ -62,11 +62,8 @@ use Tz\WordPress\Tools;
<td>
Sent To:
</td>
<td>
<select
name=
"sendto"
class=
"wide-input-field"
>
<optgroup
label=
"By User:"
>
<option
value=
"user"
<?php
echo
(
$validation
->
set_value
(
'sendto'
)
==
"user"
)
?
'selected="selected"'
:
""
;
?>
>
Current User
</option>
<option
value=
"allusers"
<?php
echo
(
$validation
->
set_value
(
'sendto'
)
==
"allusers"
)
?
'selected="selected"'
:
""
;
?>
>
All Users
</option>
</optgroup>
<optgroup
label=
"By User Group:"
>
<optgroup
label=
"By Group:"
>
<?php
foreach
(
Notifications\getGroups
()
as
$group_id
=>
$group_name
)
:?>
<
option
value
=
"<?php echo
$group_id
?>"
<?
php
echo
(
$validation
->
set_value
(
'sendto'
)
==
$group_id
)
?
'selected="selected"'
:
""
;
?>
>
<?php
echo
$group_name
;
?>
</option>
<?php
endforeach
;
?>
...
...
com/Notifications/views/form.php
View file @
a330b4c
...
...
@@ -65,11 +65,8 @@ use Tz\WordPress\Tools;
<td>
<select
name=
"sendto"
class=
"wide-input-field"
>
<optgroup
label=
"By User:"
>
<option
value=
"user"
<?php
echo
(
$validation
->
set_value
(
'sendto'
,
$entry
->
details
[
'sendto'
])
==
"user"
)
?
'selected="selected"'
:
""
;
?>
>
Current User
</option>
<option
value=
"allusers"
<?php
echo
(
$validation
->
set_value
(
'sendto'
,
$entry
->
details
[
'sendto'
])
==
"allusers"
)
?
'selected="selected"'
:
""
;
?>
>
All Users
</option>
</optgroup>
<optgroup
label=
"By User Group:"
>
<optgroup
label=
"By Group:"
>
<?php
foreach
(
Notifications\getGroups
()
as
$group_id
=>
$group_name
)
:?>
<
option
value
=
"<?php echo
$group_id
?>"
<?
php
echo
(
$validation
->
set_value
(
'sendto'
,
$entry
->
details
[
'sendto'
])
==
$group_id
)
?
'selected="selected"'
:
""
;
?>
>
<?php
echo
$group_name
;
?>
</option>
<?php
endforeach
;
?>
...
...
com/UserManager/views/edit_user_overview.php
View file @
a330b4c
...
...
@@ -170,6 +170,10 @@ use WP_User, WP_Roles;
<td
width=
"20"
><input
type=
"checkbox"
id=
"tax_exempt"
name=
"special_status[]"
value=
"tax_exempt"
<?php
search_special_status
(
'tax_exempt'
);
?>
/></td>
<td><label
for=
"tax_exempt"
>
Tax Exemption
</label></td>
</tr>
<tr>
<td
width=
"20"
><input
type=
"checkbox"
id=
"status_life"
name=
"special_status[]"
value=
"status_life"
<?php
search_special_status
(
'status_life'
);
?>
/></td>
<td><label
for=
"status_life"
>
Life Member
</label></td>
</tr>
</tbody>
</table>
...
...
Please
register
or
sign in
to post a comment