Skip to:
Content

BuddyPress.org

Ticket #9232: 9232.1.patch

File 9232.1.patch, 1.8 KB (added by dcavins, 10 months ago)

Check that notifications are active before attempting to use the nofitication class.

  • src/bp-members/bp-members-notifications.php

    diff --git src/bp-members/bp-members-notifications.php src/bp-members/bp-members-notifications.php
    index 922129d5a..56038b3dc 100644
    function members_format_notifications( $action, $item_id, $secondary_item_id, $t 
    142142 * @param int           $inviter_id ID of the user who invited this user to the site.
    143143 */
    144144function bp_members_invitations_accepted_invitation_notification( $invite, $new_user, $inviter_id ) {
     145        if ( ! bp_is_active( 'notifications' ) ) {
     146                return;
     147        }
    145148
    146149        // Notify all inviters.
    147150        $args = array(
    add_action( 'members_invitations_invite_accepted', 'bp_members_invitations_accep 
    182185 * @since 8.0.0
    183186 */
    184187function bp_members_mark_read_accepted_invitation_notification() {
    185         if ( false === is_singular() || false === is_user_logged_in() || ! bp_is_user() || empty( $_GET['welcome'] ) ) {
     188        if ( false === is_singular() || false === is_user_logged_in() || ! bp_is_user() || empty( $_GET['welcome'] ) || ! bp_is_active( 'notifications' ) ) {
    186189                return;
    187190        }
    188191
    add_action( 'bp_screens', 'bp_members_mark_read_accepted_invitation_notification 
    208211function bp_members_mark_read_submitted_membership_request_notification() {
    209212
    210213        $signup_screens = array( 'users_page_bp-signups', 'users_page_bp-signups-network' );
    211         if ( ! wp_doing_ajax() && in_array( get_current_screen()->base, $signup_screens, true ) && ! empty( $_GET['mod_req'] ) && ! empty( $_GET['signup_id'] ) ) {
     214        if ( ! wp_doing_ajax() && in_array( get_current_screen()->base, $signup_screens, true ) && ! empty( $_GET['mod_req'] ) && ! empty( $_GET['signup_id'] ) && bp_is_active( 'notifications' ) ) {
    212215                // Mark all notifications about this request as read.
    213216                BP_Notifications_Notification::update(
    214217                        array(