Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/11/2018 06:46:30 PM (19 months ago)
Author:
boonebgorges
Message:

Move notification settings callbacks out of lazyloaded screen function files.

Loading these add_action() callbacks conditionally caused the
has_action() check in bp_settings_remove_email_subnav() to think
that no components had registered notification settings.

Props r-a-y.
Fixes #7822.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-notifications.php

    r11606 r12087  
    10531053}
    10541054add_action( 'groups_remove_data_for_user', 'bp_groups_remove_data_for_user_notifications', 10 );
     1055
     1056/**
     1057 * Render the group settings fields on the Notification Settings page.
     1058 *
     1059 * @since 1.0.0
     1060 */
     1061function groups_screen_notification_settings() {
     1062
     1063    if ( !$group_invite = bp_get_user_meta( bp_displayed_user_id(), 'notification_groups_invite', true ) )
     1064        $group_invite  = 'yes';
     1065
     1066    if ( !$group_update = bp_get_user_meta( bp_displayed_user_id(), 'notification_groups_group_updated', true ) )
     1067        $group_update  = 'yes';
     1068
     1069    if ( !$group_promo = bp_get_user_meta( bp_displayed_user_id(), 'notification_groups_admin_promotion', true ) )
     1070        $group_promo   = 'yes';
     1071
     1072    if ( !$group_request = bp_get_user_meta( bp_displayed_user_id(), 'notification_groups_membership_request', true ) )
     1073        $group_request = 'yes';
     1074
     1075    if ( ! $group_request_completed = bp_get_user_meta( bp_displayed_user_id(), 'notification_membership_request_completed', true ) ) {
     1076        $group_request_completed = 'yes';
     1077    }
     1078    ?>
     1079
     1080    <table class="notification-settings" id="groups-notification-settings">
     1081        <thead>
     1082            <tr>
     1083                <th class="icon"></th>
     1084                <th class="title"><?php _ex( 'Groups', 'Group settings on notification settings page', 'buddypress' ) ?></th>
     1085                <th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
     1086                <th class="no"><?php _e( 'No', 'buddypress' )?></th>
     1087            </tr>
     1088        </thead>
     1089
     1090        <tbody>
     1091            <tr id="groups-notification-settings-invitation">
     1092                <td></td>
     1093                <td><?php _ex( 'A member invites you to join a group', 'group settings on notification settings page','buddypress' ) ?></td>
     1094                <td class="yes"><input type="radio" name="notifications[notification_groups_invite]" id="notification-groups-invite-yes" value="yes" <?php checked( $group_invite, 'yes', true ) ?>/><label for="notification-groups-invite-yes" class="bp-screen-reader-text"><?php
     1095                    /* translators: accessibility text */
     1096                    _e( 'Yes, send email', 'buddypress' );
     1097                ?></label></td>
     1098                <td class="no"><input type="radio" name="notifications[notification_groups_invite]" id="notification-groups-invite-no" value="no" <?php checked( $group_invite, 'no', true ) ?>/><label for="notification-groups-invite-no" class="bp-screen-reader-text"><?php
     1099                    /* translators: accessibility text */
     1100                    _e( 'No, do not send email', 'buddypress' );
     1101                ?></label></td>
     1102            </tr>
     1103            <tr id="groups-notification-settings-info-updated">
     1104                <td></td>
     1105                <td><?php _ex( 'Group information is updated', 'group settings on notification settings page', 'buddypress' ) ?></td>
     1106                <td class="yes"><input type="radio" name="notifications[notification_groups_group_updated]" id="notification-groups-group-updated-yes" value="yes" <?php checked( $group_update, 'yes', true ) ?>/><label for="notification-groups-group-updated-yes" class="bp-screen-reader-text"><?php
     1107                    /* translators: accessibility text */
     1108                    _e( 'Yes, send email', 'buddypress' );
     1109                ?></label></td>
     1110                <td class="no"><input type="radio" name="notifications[notification_groups_group_updated]" id="notification-groups-group-updated-no" value="no" <?php checked( $group_update, 'no', true ) ?>/><label for="notification-groups-group-updated-no" class="bp-screen-reader-text"><?php
     1111                    /* translators: accessibility text */
     1112                    _e( 'No, do not send email', 'buddypress' );
     1113                ?></label></td>
     1114            </tr>
     1115            <tr id="groups-notification-settings-promoted">
     1116                <td></td>
     1117                <td><?php _ex( 'You are promoted to a group administrator or moderator', 'group settings on notification settings page', 'buddypress' ) ?></td>
     1118                <td class="yes"><input type="radio" name="notifications[notification_groups_admin_promotion]" id="notification-groups-admin-promotion-yes" value="yes" <?php checked( $group_promo, 'yes', true ) ?>/><label for="notification-groups-admin-promotion-yes" class="bp-screen-reader-text"><?php
     1119                    /* translators: accessibility text */
     1120                    _e( 'Yes, send email', 'buddypress' );
     1121                ?></label></td>
     1122                <td class="no"><input type="radio" name="notifications[notification_groups_admin_promotion]" id="notification-groups-admin-promotion-no" value="no" <?php checked( $group_promo, 'no', true ) ?>/><label for="notification-groups-admin-promotion-no" class="bp-screen-reader-text"><?php
     1123                    /* translators: accessibility text */
     1124                    _e( 'No, do not send email', 'buddypress' );
     1125                ?></label></td>
     1126            </tr>
     1127            <tr id="groups-notification-settings-request">
     1128                <td></td>
     1129                <td><?php _ex( 'A member requests to join a private group for which you are an admin', 'group settings on notification settings page', 'buddypress' ) ?></td>
     1130                <td class="yes"><input type="radio" name="notifications[notification_groups_membership_request]" id="notification-groups-membership-request-yes" value="yes" <?php checked( $group_request, 'yes', true ) ?>/><label for="notification-groups-membership-request-yes" class="bp-screen-reader-text"><?php
     1131                    /* translators: accessibility text */
     1132                    _e( 'Yes, send email', 'buddypress' );
     1133                ?></label></td>
     1134                <td class="no"><input type="radio" name="notifications[notification_groups_membership_request]" id="notification-groups-membership-request-no" value="no" <?php checked( $group_request, 'no', true ) ?>/><label for="notification-groups-membership-request-no" class="bp-screen-reader-text"><?php
     1135                    /* translators: accessibility text */
     1136                    _e( 'No, do not send email', 'buddypress' );
     1137                ?></label></td>
     1138            </tr>
     1139            <tr id="groups-notification-settings-request-completed">
     1140                <td></td>
     1141                <td><?php _ex( 'Your request to join a group has been approved or denied', 'group settings on notification settings page', 'buddypress' ) ?></td>
     1142                <td class="yes"><input type="radio" name="notifications[notification_membership_request_completed]" id="notification-groups-membership-request-completed-yes" value="yes" <?php checked( $group_request_completed, 'yes', true ) ?>/><label for="notification-groups-membership-request-completed-yes" class="bp-screen-reader-text"><?php
     1143                    /* translators: accessibility text */
     1144                    _e( 'Yes, send email', 'buddypress' );
     1145                ?></label></td>
     1146                <td class="no"><input type="radio" name="notifications[notification_membership_request_completed]" id="notification-groups-membership-request-completed-no" value="no" <?php checked( $group_request_completed, 'no', true ) ?>/><label for="notification-groups-membership-request-completed-no" class="bp-screen-reader-text"><?php
     1147                    /* translators: accessibility text */
     1148                    _e( 'No, do not send email', 'buddypress' );
     1149                ?></label></td>
     1150            </tr>
     1151
     1152            <?php
     1153
     1154            /**
     1155             * Fires at the end of the available group settings fields on Notification Settings page.
     1156             *
     1157             * @since 1.0.0
     1158             */
     1159            do_action( 'groups_screen_notification_settings' ); ?>
     1160
     1161        </tbody>
     1162    </table>
     1163
     1164<?php
     1165}
     1166add_action( 'bp_notification_settings', 'groups_screen_notification_settings' );
Note: See TracChangeset for help on using the changeset viewer.