Making WordPress.org


Ignore:
Timestamp:
02/09/2022 01:20:09 AM (3 years ago)
Author:
dd32
Message:

Support Forums: Record stats on the number of subscriptions added/removed/notified per day.

This will hopefully be used to determine if more people unsubscribe from emails over time in response to any improvements we make.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-term-subscription/inc/class-plugin.php

    r11530 r11533  
    248248
    249249        // Replace forum subscriber list with term subscribers, avoiding duplicates.
    250         add_filter( 'bbp_forum_subscription_user_ids', array( $this, 'add_term_subscribers_to_forum' ) );
     250        add_filter( 'bbp_forum_subscription_user_ids', array( $this, 'add_term_subscribers' ) );
    251251
    252252        // Actually notify our term subscribers.
     
    254254
    255255        // Remove filters.
    256         remove_filter( 'bbp_forum_subscription_user_ids',     array( $this, 'add_term_subscribers_to_forum' ) );
     256        remove_filter( 'bbp_forum_subscription_user_ids',     array( $this, 'add_term_subscribers' ) );
    257257        remove_filter( 'bbp_forum_subscription_mail_message', array( $this, 'replace_forum_subscription_mail_message' ), 10 );
    258258
     
    262262     * Temporarily replace the forum subscriber list with any unincluded term subscribers.
    263263     */
    264     public function add_term_subscribers_to_forum( $users ) {
     264    public function add_term_subscribers( $users ) {
    265265        return array_diff( $this->subscribers, $users );
    266266    }
     
    369369
    370370        // Replace forum subscriber list with term subscribers, avoiding duplicates.
    371         add_filter( 'bbp_topic_subscription_user_ids', array( $this, 'add_term_subscribers_to_topic' ) );
     371        add_filter( 'bbp_topic_subscription_user_ids', array( $this, 'add_term_subscribers' ) );
    372372
    373373        // Actually notify our term subscribers.
     
    375375
    376376        // Remove filters.
    377         remove_filter( 'bbp_topic_subscription_user_ids', array( $this, 'add_term_subscribers_to_topic' ) );
     377        remove_filter( 'bbp_topic_subscription_user_ids', array( $this, 'add_term_subscribers' ) );
    378378        remove_filter( 'bbp_subscription_mail_message',   array( $this, 'replace_topic_subscription_mail_message' ) );
    379     }
    380 
    381     /**
    382      * Temporarily replace the forum subscriber list with any unincluded term subscribers.
    383      */
    384     public function add_term_subscribers_to_topic( $users ) {
    385         return array_diff( $this->subscribers, $users );
    386379    }
    387380
     
    566559     * @return bool False if invalid, otherwise true
    567560     */
    568     public static function add_user_subscription( $user_id = 0, $term_id = 0 ) {
     561    public static function add_user_subscription( $user_id, $term_id ) {
    569562        if ( empty( $user_id ) || empty( $term_id ) ) {
    570563            return false;
     
    575568            wp_cache_delete( 'wporg_bbp_get_term_subscribers_' . $term_id, 'bbpress_users' );
    576569        }
     570
    577571        do_action( 'wporg_bbp_add_user_term_subscription', $user_id, $term_id );
    578572
     
    587581     * @return bool False if invalid, otherwise true
    588582     */
    589     public static function remove_user_subscription( $user_id = 0, $term_id = 0 ) {
     583    public static function remove_user_subscription( $user_id, $term_id ) {
    590584        if ( empty( $user_id ) || empty( $term_id ) ) {
    591585            return false;
     
    596590            wp_cache_delete( 'wporg_bbp_get_term_subscribers_' . $term_id, 'bbpress_users' );
    597591        }
     592
    598593        do_action( 'wporg_bbp_remove_user_term_subscription', $user_id, $term_id );
    599594
Note: See TracChangeset for help on using the changeset viewer.