PluginProbe
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP / 1.0.22
UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP v1.0.22
1.2.73 1.2.72 1.2.71 1.2.70 1.2.69 1.2.68 1.2.67 1.2.66 1.2.65 1.2.64 1.2.63 trunk 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 All 173 releases
userswp / includes / class-user-notifications.php

class-user-notifications.php in UsersWP – Front-end login form, User Registration, User Profile & Members Directory plugin for WP 1.0.22, at includes/class-user-notifications.php

92 lines 4.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * User Notifications related functions
4 *
5 * All UsersWP related mails are sent via this class.
6 *
7 * @since 1.0.20
8 * @author GeoDirectory Team <info@wpgeodirectory.com>
9 */
10 class UsersWP_Notifications {
11
12 public function __construct() {
13
14 }
15
16 public function uwp_user_notifications_form_front($type){
17 if ($type == 'notifications') {
18 $user_id = get_current_user_id();
19 echo '<div class="uwp-account-form uwp_wc_form">';
20 ?>
21 <div class="uwp-profile-extra">
22 <div class="uwp-profile-extra-div form-table">
23 <form class="uwp-account-form uwp_form" method="post">
24 <?php
25 $value = get_user_meta($user_id, 'uwp_mute_notifications', true);
26 $notifications_types = array();
27
28 if( 1 == uwp_get_option('enable_account_update_notification' )){
29 $notifications_types = array(
30 'account_update' => __('Disable account update notification.', 'userswp'),
31 );
32 }
33 $notifications_types = apply_filters('uwp_mute_notification_types', $notifications_types, $user_id);
34
35 if($notifications_types) {
36 foreach ($notifications_types as $id => $text) {
37 if(isset($value) && !empty($value) && isset($value[$id])){
38 $checked = $value[$id];
39 } else {
40 $checked = 0;
41 }
42 ?>
43 <div class="uwp-profile-extra-wrap uwp_mute_notification_items">
44 <div id="uwp_mute_<?php echo $id; ?>"
45 class="uwp_mute_notification_item uwp_mute_<?php echo $id; ?>">
46 <input name="uwp_mute_notifications[<?php echo $id; ?>]"
47 class="" <?php checked($checked, "1", true); ?> type="checkbox"
48 value="1"><?php echo $text; ?>
49 </div>
50 </div>
51 <?php }
52 ?>
53 <input type="hidden" name="uwp_notification_nonce" value="<?php echo wp_create_nonce( 'uwp-notification-nonce' ); ?>" />
54 <input name="uwp_notification_submit" value="<?php echo __( 'Submit', 'userswp' ); ?>" type="submit">
55 <?php
56 } else {
57 echo '<p>'.__( 'You will see the options to disable the active notifications for UsersWP and it\'s add ons.', 'userswp' ).'</p>';
58 }?>
59 </form>
60 </div>
61 </div>
62 <?php
63 echo '</div>';
64 }
65 }
66
67 /**
68 * Handles the notifications form submission.
69 *
70 * @since 1.0.0
71 * @package userswp
72 *
73 * @return void
74 */
75 public function uwp_notification_submit_handler() {
76 if (isset($_POST['uwp_notification_submit'])) {
77 if( ! isset( $_POST['uwp_notification_nonce'] ) || ! wp_verify_nonce( $_POST['uwp_notification_nonce'], 'uwp-notification-nonce' ) ) {
78 return;
79 }
80
81 $user_id = get_current_user_id();
82 if (isset($_POST['uwp_mute_notifications']) && !empty($_POST['uwp_mute_notifications'])) {
83 update_user_meta($user_id, 'uwp_mute_notifications', $_POST['uwp_mute_notifications']);
84 }
85
86 do_action('uwp_handle_notification_submit', $user_id);
87
88 }
89 }
90
91
92 }