-
Notifications
You must be signed in to change notification settings - Fork 0
/
screen-user-settings.php
129 lines (107 loc) · 5.64 KB
/
screen-user-settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
/**
* GES code meant to be run only on a user's "Settings > Email" page.
*
* @since 3.7.0
*/
// adds forum notification options in the users settings->notifications page
function ass_group_subscription_notification_settings() {
// get forum type
$forums = ass_get_forum_type();
// no forums installed? stop now!
if ( ! $forums ) {
return;
}
?>
<table class="notification-settings zebra" id="groups-subscription-notification-settings">
<thead>
<tr>
<th class="icon"><span class="bp-screen-reader-text"><?php esc_html_e( 'Item icon', 'buddypress-group-email-subscription' ); ?></span></th>
<th class="title"><?php _e( 'Group Forum', 'buddypress-group-email-subscription' ) ?></th>
<th class="yes"><?php _e( 'Yes', 'buddypress-group-email-subscription' ) ?></th>
<th class="no"><?php _e( 'No', 'buddypress-group-email-subscription' )?></th>
</tr>
</thead>
<tbody>
<?php
// only add the following options if BP's bundled forums are installed...
// @todo add back these options for bbPress if possible.
?>
<?php if ( $forums == 'buddypress' ) :
if ( ! $replies_to_topic = bp_get_user_meta( bp_displayed_user_id(), 'ass_replies_to_my_topic', true ) ) {
$replies_to_topic = 'yes';
}
if ( ! $replies_after_me = bp_get_user_meta( bp_displayed_user_id(), 'ass_replies_after_me_topic', true ) ) {
$replies_after_me = 'yes';
}
?>
<tr>
<td></td>
<td><?php _e( 'A member replies in a forum topic you\'ve started', 'buddypress-group-email-subscription' ) ?></td>
<td class="yes">
<input type="radio" name="notifications[ass_replies_to_my_topic]" id="notification-ass-replies-to-my-topic-yes" value="yes" <?php checked( $replies_to_topic, 'yes', true ); ?>/>
<label class="bp-screen-reader-text" for="notification-ass-replies-to-my-topic-yes"><?php esc_html_e( 'Yes, send email', 'buddypress-group-email-subscription' ); ?></label>
</td>
<td class="no">
<input type="radio" name="notifications[ass_replies_to_my_topic]" value="no" id="notification-ass-replies-to-my-topic-no" <?php checked( $replies_to_topic, 'no', true ); ?>/>
<label class="bp-screen-reader-text" for="notification-ass-replies-to-my-topic-no"><?php esc_html_e( 'Yes, send email', 'buddypress-group-email-subscription' ); ?></label>
</td>
</tr>
<tr>
<td></td>
<td><?php _e( 'A member replies after you in a forum topic', 'buddypress-group-email-subscription' ) ?></td>
<td class="yes">
<input type="radio" name="notifications[ass_replies_after_me_topic]" id="notification-ass-replies-after-me-yes" value="yes" <?php checked( $replies_after_me, 'yes', true ); ?>/>
<label class="bp-screen-reader-text" for="notification-ass-replies-after-me-no"><?php esc_html_e( 'Yes, send email', 'buddypress-group-email-subscription' ); ?></label>
</td>
<td class="no">
<input type="radio" name="notifications[ass_replies_after_me_topic]" id="notification-ass-replies-after-me-no" value="no" <?php checked( $replies_after_me, 'no', true ); ?>/>
<label class="bp-screen-reader-text" for="notification-ass-replies-after-me-yes"><?php esc_html_e( 'No, do not send email', 'buddypress-group-email-subscription' ); ?></label>
</td>
</tr>
<?php endif; ?>
<tr>
<td></td>
<td><?php _e( 'Receive immeditate notifications of your own posts?<br>(Your posts are always included in digests.)', 'buddypress-group-email-subscription' ) ?></td>
<td class="yes">
<input type="radio" name="notifications[ass_self_post_notification]" id="notification-ass-self-post-yes" value="yes" <?php if ( ass_self_post_notification( bp_displayed_user_id() ) ) { ?>checked="checked" <?php } ?>/>
<label class="bp-screen-reader-text" for="notification-ass-self-post-yes"><?php esc_html_e( 'No, do not send email', 'buddypress-group-email-subscription' ); ?></label>
</td>
<td class="no">
<input type="radio" name="notifications[ass_self_post_notification]" id="notification-ass-self-post-no" value="no" <?php if ( !ass_self_post_notification( bp_displayed_user_id() ) ) { ?>checked="checked" <?php } ?>/>
<label class="bp-screen-reader-text" for="notification-ass-self-post-no"><?php esc_html_e( 'No, do not send email', 'buddypress-group-email-subscription' ); ?></label>
</td>
</tr>
<?php do_action( 'ass_group_subscription_notification_settings' ); ?>
</tbody>
</table>
<?php
}
add_action( 'bp_notification_settings', 'ass_group_subscription_notification_settings' );
// Add a notice at end of email notification about how to change group email subscriptions
function ass_add_notice_to_notifications_page() {
?>
<div id="group-email-settings">
<table class="notification-settings zebra">
<thead>
<tr>
<th class="icon"> </th>
<th class="title"><?php _e( 'Individual Group Email Settings', 'buddypress-group-email-subscription' ); ?></th>
</tr>
</thead>
<tbody>
<tr>
<td> </td>
<td>
<p><?php printf( __('To change the email notification settings for your groups, go to %s and click "Change" for each group.', 'buddypress-group-email-subscription' ), '<a href="'. bp_loggedin_user_domain() . trailingslashit( BP_GROUPS_SLUG ) . '">' . __( 'My Groups' ,'buddypress-group-email-subscription' ) . '</a>' ); ?></p>
<?php if ( get_option( 'ass-global-unsubscribe-link' ) == 'yes' ) : ?>
<p><a href="<?php echo wp_nonce_url( add_query_arg( 'ass_unsubscribe', 'all' ), 'ass_unsubscribe_all' ); ?>"><?php _e( "Or set all your group's email options to No Email", 'buddypress-group-email-subscription' ); ?></a></p>
<?php endif; ?>
</td>
</tr>
</tbody>
</table>
</div>
<?php
}
add_action( 'bp_notification_settings', 'ass_add_notice_to_notifications_page', 9000 );