Making WordPress.org


Ignore:
Timestamp:
06/30/2017 02:45:04 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Support Forums: Check "Notify me of follow-up replies via email" checkbox for new topics by default.

See #6.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php

    r5300 r5608  
    88        // Basic behavior filters and actions.
    99        add_filter( 'bbp_get_forum_pagination_count', '__return_empty_string' );
     10        add_filter( 'bbp_get_form_topic_subscribed',  array( $this, 'check_topic_subscription_checkbox' ) );
    1011        add_action( 'pre_get_posts',                  array( $this, 'hide_non_public_forums' ) );
    1112        add_filter( 'pre_option__bbp_edit_lock',      array( $this, 'increase_edit_lock_time' ) );
     
    4445        // Honor i18n number formatting.
    4546        add_filter( 'bbp_number_format', array( $this, 'number_format_i18n' ), 10, 5 );
     47    }
     48
     49    /**
     50     * Check "Notify me of follow-up replies via email" checkbox for new topics by default.
     51     *
     52     * @param string $checked Checked value of topic subscription.
     53     * @return string Checked value of topic subscription.
     54     */
     55    function check_topic_subscription_checkbox( $checked ) {
     56        if ( bbp_is_single_forum() || bbp_is_single_view() ) {
     57            $checked = checked( true, true, false );
     58        }
     59
     60        return $checked;
    4661    }
    4762
Note: See TracChangeset for help on using the changeset viewer.