Skip to:
Content

BuddyPress.org

Changeset 13320


Ignore:
Timestamp:
08/19/2022 03:06:51 PM (4 years ago)
Author:
dcavins
Message:

Membership Requests: Check if notifications are active.

Before attempting to delete notifications related to a
membership request, ensure that the notifications
component is active.

Props babyface, pycc, MickFrench.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/10.0/src/bp-members/bp-members-membership-requests.php

    r13171 r13320  
    246246 */
    247247function bp_members_membership_requests_delete_notifications_on_change( $signup_ids ) {
    248         foreach ( $signup_ids as $signup_id ) {
    249                 BP_Notifications_Notification::delete(
    250                         array(
    251                                 'item_id'          => $signup_id,
    252                                 'component_action' => 'membership_request_submitted',
    253                         )
    254                 );
     248        if ( bp_is_active( 'notifications' ) ) {
     249                foreach ( $signup_ids as $signup_id ) {
     250                        /**
     251                         * We use this method instead of one of the notification functions
     252                         * because we want to delete all notifications for all admins.
     253                         */
     254                        BP_Notifications_Notification::delete(
     255                                array(
     256                                        'item_id'          => $signup_id,
     257                                        'component_action' => 'membership_request_submitted',
     258                                )
     259                        );
     260                }
    255261        }
    256262}
Note: See TracChangeset for help on using the changeset viewer.