Changeset 13168 for trunk/src/bp-members/bp-members-notifications.php
- Timestamp:
- 12/10/2021 04:14:37 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-members/bp-members-notifications.php
r13105 r13168 60 60 $text = sprintf( __( '%s is now a member of the site', 'buddypress' ), bp_core_get_user_displayname( $item_id ) ); 61 61 } 62 } 63 break; 64 65 case 'membership_request_submitted': 66 // $item_id is the id of the signup, not the user ID. 67 $signup = new BP_Signup( $item_id ); 68 69 // Set up the string and the filter. 70 if ( (int) $total_items > 1 ) { 71 $link = bp_get_notifications_permalink(); 72 $amount = 'multiple'; 73 74 $text = sprintf( __( '%d people have requested site membership.', 'buddypress' ), (int) $total_items ); 75 } else { 76 $link = add_query_arg( array( 77 'mod_req' => 1, 78 'page' => 'bp-signups', 79 'signup_id' => $item_id, 80 'action' => 'resend', 81 ), bp_get_admin_url( 'users.php' ) ); 82 $amount = 'single'; 83 84 /* translators: %s: new user name */ 85 $text = sprintf( __( '%s has requested site membership.', 'buddypress' ), esc_html( $signup->user_login ) ); 62 86 } 63 87 break; … … 168 192 ), 169 193 array( 170 'user_id' => bp_loggedin_user_id(), 171 'item_id' => bp_displayed_user_id(), 194 'user_id' => bp_loggedin_user_id(), 195 'item_id' => bp_displayed_user_id(), 196 'component_action' => 'accepted_invitation', 172 197 ) 173 198 ); … … 176 201 177 202 /** 203 * Mark new membership request notifications as read when user visits Manage BP Signups screen. 204 * 205 * @since 10.0.0 206 */ 207 function bp_members_mark_read_submitted_membership_request_notification() { 208 209 $signup_screens = array( 'users_page_bp-signups', 'users_page_bp-signups-network' ); 210 if ( ! wp_doing_ajax() && in_array( get_current_screen()->base, $signup_screens, true ) && ! empty( $_GET['mod_req'] ) && ! empty( $_GET['signup_id'] ) ) { 211 // Mark all notifications about this request as read. 212 BP_Notifications_Notification::update( 213 array( 214 'is_new' => false, 215 ), 216 array( 217 'item_id' => $_GET['signup_id'], 218 'component_action' => 'membership_request_submitted', 219 ) 220 ); 221 } 222 } 223 add_action( 'admin_footer', 'bp_members_mark_read_submitted_membership_request_notification' ); 224 225 /** 178 226 * Add Members-related settings to the Settings > Notifications page. 179 227 * … … 182 230 function members_screen_notification_settings() { 183 231 184 // Bail early if invitations a re not allowed--they are the only members notification so far.185 if ( ! bp_get_members_invitations_allowed () ) {232 // Bail early if invitations and requests are not allowed--they are the only members notification so far. 233 if ( ! bp_get_members_invitations_allowed() && ( ! bp_get_membership_requests_required() || ! user_can( bp_displayed_user_id(), 'bp_moderate' ) ) ) { 186 234 return; 187 }188 189 if ( ! $allow_acceptance_emails = bp_get_user_meta( bp_displayed_user_id(), 'notification_members_invitation_accepted', true ) ) {190 $allow_acceptance_emails = 'yes';191 235 } 192 236 ?> … … 203 247 204 248 <tbody> 205 <tr id="members-notification-settings-invitation_accepted">206 <td></td>207 <td><?php _ex( 'Someone accepts your membership invitation', 'Member settings on notification settings page', 'buddypress' ) ?></td>208 <td class="yes"><input type="radio" name="notifications[notification_members_invitation_accepted]" id="notification-members-invitation-accepted-yes" value="yes" <?php checked( $allow_acceptance_emails, 'yes', true ) ?>/><label for="notification-members-invitation-accepted-yes" class="bp-screen-reader-text"><?php209 /* translators: accessibility text */210 _e( 'Yes, send email', 'buddypress' );211 ?></label></td>212 <td class="no"><input type="radio" name="notifications[notification_members_invitation_accepted]" id="notification-members-invitation-accepted-no" value="no" <?php checked( $allow_acceptance_emails, 'no', true ) ?>/><label for="notification-members-invitation-accepted-no" class="bp-screen-reader-text"><?php213 /* translators: accessibility text */214 _e( 'No, do not send email', 'buddypress' );215 ?></label></td>216 </tr>217 249 218 250 <?php 251 if ( bp_get_members_invitations_allowed() ) : 252 if ( ! $allow_acceptance_emails = bp_get_user_meta( bp_displayed_user_id(), 'notification_members_invitation_accepted', true ) ) { 253 $allow_acceptance_emails = 'yes'; 254 } 255 ?> 256 <tr id="members-notification-settings-invitation_accepted"> 257 <td></td> 258 <td><?php echo esc_html_x( 'Someone accepts your membership invitation', 'Member settings on notification settings page', 'buddypress' ); ?></td> 259 <td class="yes"><input type="radio" name="notifications[notification_members_invitation_accepted]" id="notification-members-invitation-accepted-yes" value="yes" <?php checked( $allow_acceptance_emails, 'yes', true ) ?>/><label for="notification-members-invitation-accepted-yes" class="bp-screen-reader-text"> 260 <?php 261 /* translators: accessibility text */ 262 esc_html_e( 'Yes, send email', 'buddypress' ); 263 ?> 264 </label></td> 265 <td class="no"><input type="radio" name="notifications[notification_members_invitation_accepted]" id="notification-members-invitation-accepted-no" value="no" <?php checked( $allow_acceptance_emails, 'no', true ) ?>/><label for="notification-members-invitation-accepted-no" class="bp-screen-reader-text"> 266 <?php 267 /* translators: accessibility text */ 268 esc_html_e( 'No, do not send email', 'buddypress' ); 269 ?> 270 </label></td> 271 </tr> 272 <?php 273 endif; 274 275 if ( bp_get_membership_requests_required() && user_can( bp_displayed_user_id(), 'bp_moderate' ) ) : 276 if ( ! $allow_request_emails = bp_get_user_meta( bp_displayed_user_id(), 'notification_members_membership_request', true ) ) { 277 $allow_request_emails = 'yes'; 278 } 279 ?> 280 <tr id="members-notification-settings-submitted_membership_request"> 281 <td></td> 282 <td><?php echo esc_html_x( 'Someone has requested site membership', 'Member settings on notification settings page', 'buddypress' ) ?></td> 283 <td class="yes"><input type="radio" name="notifications[notification_members_membership_request]" id="notification-members-submitted_membership_request-yes" value="yes" <?php checked( $allow_request_emails, 'yes', true ) ?>/><label for="notification-members-submitted_membership_request-yes" class="bp-screen-reader-text"> 284 <?php 285 /* translators: accessibility text */ 286 esc_html_e( 'Yes, send email', 'buddypress' ); 287 ?> 288 </label></td> 289 <td class="no"><input type="radio" name="notifications[notification_members_membership_request]" id="notification-members-submitted_membership_request-no" value="no" <?php checked( $allow_request_emails, 'no', true ) ?>/><label for="notification-members-submitted_membership_request-no" class="bp-screen-reader-text"> 290 <?php 291 /* translators: accessibility text */ 292 esc_html_e( 'No, do not send email', 'buddypress' ); 293 ?> 294 </label></td> 295 </tr> 296 <?php 297 endif; 219 298 220 299 /**
Note: See TracChangeset
for help on using the changeset viewer.