| 1 |
<?php |
| 2 |
/** |
| 3 |
* This template contains the notification manager. |
| 4 |
* |
| 5 |
* @version 1.0 |
| 6 |
* @package Friends |
| 7 |
*/ |
| 8 |
|
| 9 |
?><form method="post"> |
| 10 |
<?php wp_nonce_field( 'notification-manager' ); ?> |
| 11 |
<table class="form-table"> |
| 12 |
<tbody> |
| 13 |
<tr> |
| 14 |
<th scope="row"> |
| 15 |
<?php |
| 16 |
esc_html_e( 'E-Mail Notifications', 'friends' ); |
| 17 |
?> |
| 18 |
</th> |
| 19 |
<td> |
| 20 |
<fieldset> |
| 21 |
<label for="friend_request_notification"> |
| 22 |
<input name="friend_request_notification" type="checkbox" id="friend_request_notification" value="1" <?php checked( '1', ! $args['no_friend_request_notification'] ); ?>> |
| 23 |
<span><?php esc_html_e( 'Friend Requests', 'friends' ); ?></span> |
| 24 |
</label> |
| 25 |
<br /> |
| 26 |
<label for="new_post_notification"> |
| 27 |
<input name="new_post_notification" type="checkbox" id="new_post_notification" value="1" <?php checked( '1', ! $args['no_new_post_notification'] ); ?>> |
| 28 |
<span><?php esc_html_e( 'New Posts', 'friends' ); ?></span> |
| 29 |
</label> |
| 30 |
</fieldset> |
| 31 |
<p class="description"><?php esc_html_e( 'When you disable post notifications, their individual configuration is disabled also.', 'friends' ); ?></p> |
| 32 |
</td> |
| 33 |
</tr> |
| 34 |
<tr> |
| 35 |
<th scope="row"> |
| 36 |
<?php |
| 37 |
esc_html_e( 'Keyword Notifications', 'friends' ); |
| 38 |
?> |
| 39 |
</th> |
| 40 |
<td> |
| 41 |
<fieldset> |
| 42 |
|
| 43 |
<ol id="keyword-notifications"> |
| 44 |
<li id="keyword-template" style="display: none"> |
| 45 |
<input type="checkbox" name="notification_keywords_enabled[0]" value="1" checked /> |
| 46 |
<input type="text" name="notification_keywords[0]" value="" placeholder="<?php esc_html_e( 'Keyword (regex allowed)', 'friends' ); ?>"> |
| 47 |
</li> |
| 48 |
<?php foreach ( $args['notification_keywords'] as $i => $entry ) : ?> |
| 49 |
<li> |
| 50 |
<input type="checkbox" name="notification_keywords_enabled[<?php echo esc_attr( $i + 1 ); ?>]" value="1" <?php checked( $entry['enabled'] ); ?> /> |
| 51 |
<input type="text" name="notification_keywords[<?php echo esc_attr( $i + 1 ); ?>]" value="<?php echo esc_attr( $entry['keyword'] ); ?>" placeholder="<?php esc_html_e( 'Keyword (regex allowed)', 'friends' ); ?>"> |
| 52 |
</li> |
| 53 |
<?php endforeach; ?> |
| 54 |
</ol> |
| 55 |
<a href="" id="admin-add-keyword"><?php esc_html_e( 'Add a notification keyword', 'friends' ); ?></a> |
| 56 |
</fieldset> |
| 57 |
<p class="description"><?php esc_html_e( 'Empty keywords will be deleted after saving. You can temporarily disable them with the checkbox.', 'friends' ); ?></p> |
| 58 |
</td> |
| 59 |
</tr> |
| 60 |
</tbody> |
| 61 |
</table> |
| 62 |
<p class="submit"> |
| 63 |
<input type="submit" id="submit" class="button button-primary" value="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Save Changes' ); ?>"> |
| 64 |
</p> |
| 65 |
|
| 66 |
<h2><?php esc_html_e( 'Individual Friend Settings', 'friends' ); ?></h2> |
| 67 |
<table class="wp-list-table widefat fixed striped" style="margin-top: 2em; margin-bottom: 2em; margin-right: 1em"> |
| 68 |
<thead> |
| 69 |
<tr> |
| 70 |
<th class="column-primary column-friend"><?php esc_html_e( 'Friend', 'friends' ); ?></th> |
| 71 |
<th class="column-friends-page-feeds"><?php esc_html_e( 'Show on friends page', 'friends' ); ?></th> |
| 72 |
<th class="column-email-notification"><?php esc_html_e( 'E-Mail Notification', 'friends' ); ?></th> |
| 73 |
<th class="column-email-notification"><?php esc_html_e( 'Keyword Notification', 'friends' ); ?></th> |
| 74 |
<?php do_action( 'friends_notification_manager_header' ); ?> |
| 75 |
</tr> |
| 76 |
</thead> |
| 77 |
<tbody> |
| 78 |
<?php foreach ( $args['friend_users'] as $friend_user ) : ?> |
| 79 |
<tr> |
| 80 |
<td class="column-friend"> |
| 81 |
<a href="<?php echo esc_url( Friends\Admin::get_edit_friend_link( $friend_user->user_login ) ); ?>"><?php echo esc_html( $friend_user->display_name ); ?></a> |
| 82 |
<input type="hidden" name="friend_listed[]" value="<?php echo esc_attr( $friend_user->user_login ); ?>" /> |
| 83 |
</td> |
| 84 |
<td class="column-friends-page-feeds"> |
| 85 |
<input name="show_on_friends_page[<?php echo esc_attr( $friend_user->user_login ); ?>]" type="checkbox" id="show_on_friends_page" value="1" <?php checked( '1', ! in_array( $friend_user->user_login, $args['hide_from_friends_page'] ) ); ?> /> |
| 86 |
</td> |
| 87 |
<td class="column-email-notification"> |
| 88 |
<?php if ( $args['no_new_post_notification'] ) : ?> |
| 89 |
<input disabled="disabled" type="checkbox" <?php checked( '1', ! get_user_option( 'friends_no_new_post_notification_' . $friend_user->user_login ) ); ?> /> |
| 90 |
<input name="new_friend_post_notification[<?php echo esc_attr( $friend_user->user_login ); ?>]" type="hidden" value="<?php echo get_user_option( 'friends_no_new_post_notification_' . $friend_user->user_login ) ? '0' : '1'; ?>" /> |
| 91 |
<?php else : ?> |
| 92 |
<input name="new_friend_post_notification[<?php echo esc_attr( $friend_user->user_login ); ?>]" type="checkbox" id="friends_new_friend_post_notification" value="1" <?php checked( '1', ! get_user_option( 'friends_no_new_post_notification_' . $friend_user->user_login ) ); ?> <?php echo $args['no_new_post_notification'] ? 'disabled="disabled"' : ''; ?> |
| 93 |
/> |
| 94 |
<?php endif; ?> |
| 95 |
</td> |
| 96 |
<td class="column-keyword-notification"> |
| 97 |
<input name="keyword_notification[<?php echo esc_attr( $friend_user->user_login ); ?>]" type="checkbox" id="friends_keyword_notification" value="1" <?php checked( '1', ! get_user_option( 'friends_no_keyword_notification_' . $friend_user->user_login ) ); ?> <?php echo $args['no_keyword_notification'] ? 'disabled="disabled"' : ''; ?> |
| 98 |
/> |
| 99 |
</td> |
| 100 |
<?php do_action( 'friends_notification_manager_row', $friend_user ); ?> |
| 101 |
</tr> |
| 102 |
<?php endforeach; ?> |
| 103 |
</tbody> |
| 104 |
</table> |
| 105 |
<p class="submit"> |
| 106 |
<input type="submit" id="submit" class="button button-primary" value="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Save Changes' ); ?>"> |
| 107 |
</p> |
| 108 |
</form> |
| 109 |
|