Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/11/2018 06:46:30 PM (18 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-messages/bp-messages-notifications.php

    r11800 r12087  
    240240}
    241241add_action( 'bp_messages_thread_after_delete', 'bp_messages_message_delete_notifications', 10, 2 );
     242
     243/**
     244 * Render the markup for the Messages section of Settings > Notifications.
     245 *
     246 * @since 1.0.0
     247 */
     248function messages_screen_notification_settings() {
     249
     250    if ( bp_action_variables() ) {
     251        bp_do_404();
     252        return;
     253    }
     254
     255    if ( !$new_messages = bp_get_user_meta( bp_displayed_user_id(), 'notification_messages_new_message', true ) ) {
     256        $new_messages = 'yes';
     257    } ?>
     258
     259    <table class="notification-settings" id="messages-notification-settings">
     260        <thead>
     261            <tr>
     262                <th class="icon"></th>
     263                <th class="title"><?php _e( 'Messages', 'buddypress' ) ?></th>
     264                <th class="yes"><?php _e( 'Yes', 'buddypress' ) ?></th>
     265                <th class="no"><?php _e( 'No', 'buddypress' )?></th>
     266            </tr>
     267        </thead>
     268
     269        <tbody>
     270            <tr id="messages-notification-settings-new-message">
     271                <td></td>
     272                <td><?php _e( 'A member sends you a new message', 'buddypress' ) ?></td>
     273                <td class="yes"><input type="radio" name="notifications[notification_messages_new_message]" id="notification-messages-new-messages-yes" value="yes" <?php checked( $new_messages, 'yes', true ) ?>/><label for="notification-messages-new-messages-yes" class="bp-screen-reader-text"><?php
     274                    /* translators: accessibility text */
     275                    _e( 'Yes, send email', 'buddypress' );
     276                ?></label></td>
     277                <td class="no"><input type="radio" name="notifications[notification_messages_new_message]" id="notification-messages-new-messages-no" value="no" <?php checked( $new_messages, 'no', true ) ?>/><label for="notification-messages-new-messages-no" class="bp-screen-reader-text"><?php
     278                    /* translators: accessibility text */
     279                    _e( 'No, do not send email', 'buddypress' );
     280                ?></label></td>
     281            </tr>
     282
     283            <?php
     284
     285            /**
     286             * Fires inside the closing </tbody> tag for messages screen notification settings.
     287             *
     288             * @since 1.0.0
     289             */
     290            do_action( 'messages_screen_notification_settings' ); ?>
     291        </tbody>
     292    </table>
     293
     294<?php
     295}
     296add_action( 'bp_notification_settings', 'messages_screen_notification_settings', 2 );
Note: See TracChangeset for help on using the changeset viewer.