Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/10/2021 04:16:30 PM (3 years ago)
Author:
imath
Message:

Make the new_message notification filter consistent across formats

The 'bp_messages_' . $amount . '_new_message_notification' dynamic filter is including 6 parameters for the string format and 7 for the array format. This makes it difficult to use for Plugin developers.

To make things more consistent across formats, we are deprecating this filter in favor of a new dynamic filter 'bp_messages_' . $amount . '_new_message_' . $format . '_notification'. FYI, possible filter names are:

  • 'bp_messages_multiple_new_message_string_notification'
  • 'bp_messages_single_new_message_string_notification'
  • 'bp_messages_multiple_new_message_array_notification'
  • 'bp_messages_single_new_message_array_notification'

Fixes #8546

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/messages/notifications.php

    r11737 r13035  
    3232        ) );
    3333
    34         add_filter( 'bp_messages_multiple_new_message_notification', array( $this, 'notification_filter_callback' ) );
     34        add_filter( 'bp_messages_multiple_new_message_array_notification', array( $this, 'notification_filter_callback' ) );
    3535        $n = messages_format_notifications( 'new_message', $n, '', 2, 'array' );
    36         remove_filter( 'bp_messages_multiple_new_message_notification', array( $this, 'notification_filter_callback' ) );
     36        remove_filter( 'bp_messages_multiple_new_message_array_notification', array( $this, 'notification_filter_callback' ) );
    3737
    38         $this->assertSame( 'bp_messages_multiple_new_message_notification', $this->filter_fired );
     38        $this->assertSame( 'bp_messages_multiple_new_message_array_notification', $this->filter_fired );
    3939    }
    4040
    4141    /**
    4242     * @group messages_format_notifications
     43     * @group imath
    4344     */
    4445    public function test_friends_format_notifications_bp_messages_single_new_message_notification_nonstring_filter() {
     
    5657        ) );
    5758
    58         add_filter( 'bp_messages_single_new_message_notification', array( $this, 'notification_filter_callback' ) );
     59        add_filter( 'bp_messages_single_new_message_array_notification', array( $this, 'notification_filter_callback' ) );
    5960        $n = messages_format_notifications( 'new_message', $n, '', 1, 'array' );
    60         remove_filter( 'bp_messages_single_new_message_notification', array( $this, 'notification_filter_callback' ) );
     61        remove_filter( 'bp_messages_single_new_message_array_notification', array( $this, 'notification_filter_callback' ) );
    6162
    62         $this->assertSame( 'bp_messages_single_new_message_notification', $this->filter_fired );
     63        $this->assertSame( 'bp_messages_single_new_message_array_notification', $this->filter_fired );
    6364    }
    6465
     
    8081        ) );
    8182
    82         add_filter( 'bp_messages_multiple_new_message_notification', array( $this, 'notification_filter_callback' ) );
     83        add_filter( 'bp_messages_multiple_new_message_string_notification', array( $this, 'notification_filter_callback' ) );
    8384        $n = messages_format_notifications( 'new_message', $n, '', 2 );
    84         remove_filter( 'bp_messages_multiple_new_message_notification', array( $this, 'notification_filter_callback' ) );
     85        remove_filter( 'bp_messages_multiple_new_message_string_notification', array( $this, 'notification_filter_callback' ) );
    8586
    86         $this->assertSame( 'bp_messages_multiple_new_message_notification', $this->filter_fired );
     87        $this->assertSame( 'bp_messages_multiple_new_message_string_notification', $this->filter_fired );
    8788    }
    8889
     
    104105        ) );
    105106
    106         add_filter( 'bp_messages_single_new_message_notification', array( $this, 'notification_filter_callback' ) );
     107        add_filter( 'bp_messages_single_new_message_string_notification', array( $this, 'notification_filter_callback' ) );
    107108        $n = messages_format_notifications( 'new_message', $n, '', 1 );
    108         remove_filter( 'bp_messages_single_new_message_notification', array( $this, 'notification_filter_callback' ) );
     109        remove_filter( 'bp_messages_single_new_message_string_notification', array( $this, 'notification_filter_callback' ) );
    109110
    110         $this->assertSame( 'bp_messages_single_new_message_notification', $this->filter_fired );
     111        $this->assertSame( 'bp_messages_single_new_message_string_notification', $this->filter_fired );
    111112    }
    112113
Note: See TracChangeset for help on using the changeset viewer.