WordPress.org

Plugin Directory

Changeset 575479


Ignore:
Timestamp:
07/21/12 14:18:59 (21 months ago)
Author:
dimadin
Message:
  • Introduce optional weekly digest
  • Move event to a class to be able to handle both periods
  • Get IDs instead of whole data when querying active topics for better performance
  • Add link to settings in plugin's actions row
  • Change strings to represent neutral period
  • Check if translation is loaded to avoid multiple loads
  • Load translation in admin conditionally
  • Improve profile fields behavior
  • Improve documentation
Location:
bbpress-digest/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • bbpress-digest/trunk/bbpress-digest.php

    r573563 r575479  
    44 * The bbPress Digest Plugin 
    55 * 
    6  * Send daily digest with forum's active topics. 
     6 * Send digests with forum's active topics. 
    77 * 
    88 * @package bbPress Digest 
     
    1313 * Plugin Name: bbPress Digest 
    1414 * Plugin URI:  http://blog.milandinic.com/wordpress/plugins/bbpress-digest/ 
    15  * Description: Send daily digest with forum's active topics. 
     15 * Description: Send digests with forum's active topics. 
    1616 * Author:      Milan Dinić 
    1717 * Author URI:  http://blog.milandinic.com/ 
    18  * Version:     2.0-alfa-2 
     18 * Version:     2.0-alfa-3 
    1919 * Text Domain: bbp-digest 
    2020 * Domain Path: /languages/ 
     
    2929 * 
    3030 * @since 1.0 
     31 * 
     32 * @uses current_time() To get current UNIX time 
     33 * @uses wp_clear_scheduled_hook() To remove scheduled event 
     34 * @uses wp_schedule_event() To schedule event 
    3135 */ 
    3236function bbp_digest_activation() { 
     
    4549 * 
    4650 * @since 1.0 
     51 * 
     52 * @uses wp_next_scheduled() To get time of next event 
     53 * @uses wp_unschedule_event() To unschedule event 
    4754 */ 
    4855function bbp_digest_deactivation() { 
     
    5865 * 
    5966 * @since 1.0 
     67 * 
     68 * @uses delete_metadata() To delete all users meta data 
    6069*/ 
    6170function bbp_digest_uninstall() { 
    62     delete_metadata( 'user', null, 'bbp_digest_time', '', true ); 
     71    /* Remove users settings */ 
     72    delete_metadata( 'user', null, 'bbp_digest_time',   '', true ); 
     73    delete_metadata( 'user', null, 'bbp_digest_day',    '', true ); 
    6374    delete_metadata( 'user', null, 'bbp_digest_forums', '', true ); 
     75 
     76    /* Remove site's settings */ 
     77    delete_option( '_bbp_digest_show_one_click' ); 
     78    delete_option( '_bbp_digest_enable_weekly' ); 
    6479} 
    6580register_uninstall_hook( __FILE__, 'bbp_digest_uninstall' ); 
     
    6984 * 
    7085 * @since 2.0 
     86 * 
     87 * @uses is_user_logged_in() To check if current visitor is logged in 
     88 * @uses bbp_digest_is_it_active() To check if feature is enabled 
     89 * @uses add_action() Hooks one-click templates & AJAX handler 
     90 * @uses is_admin() To check if it's admin page 
    7191 */ 
    7292function bbp_digest_init() { 
     
    82102    /* On admin, load admin functions */ 
    83103    if ( is_admin() ) { 
    84         /* Load translations */ 
    85         bbp_digest_load_textdomain(); 
    86104        /* Load file */ 
    87105        require_once( dirname( __FILE__ ) . '/inc/admin.php' ); 
     
    94112 * 
    95113 * @since 1.0 
     114 * 
     115 * @uses is_textdomain_loaded() To check if translation is loaded 
     116 * @uses load_plugin_textdomain() To load translation file 
    96117 */ 
    97118function bbp_digest_load_textdomain() { 
    98     load_plugin_textdomain( 'bbp-digest', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); 
     119    /* If translation isn't loaded, load it */ 
     120    if ( ! is_textdomain_loaded( 'bbp-digest' ) ) 
     121        load_plugin_textdomain( 'bbp-digest', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); 
    99122} 
    100123 
     
    109132 * 
    110133 * @since 1.0 
     134 * 
     135 * @uses bbp_digest_load_textdomain() To load translation 
     136 * @uses plugin_basename() To get plugin's file name 
    111137 * 
    112138 * @param array $links Default links of plugin 
     
    124150 
    125151    if ( $file == $this_plugin ) { 
     152        $settings_link = '<a href="' . add_query_arg( array( 'page' => 'bbpress' ), admin_url( 'options-general.php' ) ) . '">' . _x( 'Settings', 'plugin actions link', 'bbp-digest' ) . '</a>'; 
    126153        $donate_link = '<a href="http://blog.milandinic.com/donate/">' . __( 'Donate', 'bbp-digest' ) . '</a>'; 
    127         $links = array_merge( array( $donate_link ), $links ); // Before other links 
     154        $links = array_merge( array( $donate_link, $settings_link ), $links ); // Before other links 
    128155    } 
    129156 
     
    136163 * 
    137164 * @since 1.0 
     165 * 
     166 * @uses bbp_digest_load_textdomain() To load translation 
     167 * @uses bbp_digest_do_event() To do process 
    138168 */ 
    139169function bbp_digest_event() { 
     
    150180 * Show settings on user profile page 
    151181 * 
     182 * @since 1.0 
     183 * 
     184 * @uses bbp_digest_load_textdomain() To load translation 
     185 * @uses bbp_digest_display_profile_fields To display fields 
     186 * 
    152187 * @param object $user Viewed user's data 
    153  * 
    154  * @since 1.0 
    155188 */ 
    156189function bbp_digest_profile_fields( $user ) { 
     
    170203 * Handle submission from users profile. 
    171204 * 
    172  * @param object $user ID of a user 
    173  * 
    174  * @since 1.0 
     205 * @since 1.0 
     206 * 
     207 * @uses bbp_digest_do_save_profile_fields() To handle submission 
     208 * 
     209 * @param int $user_id ID of a user 
    175210 */ 
    176211function bbp_digest_save_profile_fields( $user_id ) { 
     
    187222 * 
    188223 * @since 1.0 
     224 * 
     225 * @uses bbp_digest_load_textdomain() To load translation 
     226 * @uses bbp_digest_display_bbp_profile_fields() To display fields 
    189227 */ 
    190228function bbp_digest_bbp_profile_fields() { 
     
    204242 * 
    205243 * @since 2.0 
     244 * 
     245 * @uses bbp_digest_load_textdomain() To load translation 
     246 * @uses bbp_digest_display_one_click_subscription() To display link 
    206247 */ 
    207248function bbp_digest_one_click_subscription() { 
     
    218259 * 
    219260 * @since 2.0 
     261 * 
     262 * @uses bbp_digest_do_one_click_ajax_handle() To handle request 
    220263 */ 
    221264function bbp_digest_one_click_ajax_handle() { 
     
    244287 * 
    245288 * @since 2.0 
     289 * 
     290 * @uses admin_url To get URL of AJAX handler 
    246291 */ 
    247292function bbp_digest_head_scripts() { 
  • bbpress-digest/trunk/inc/admin.php

    r573561 r575479  
    1616 * @since 2.0 
    1717 * 
     18 * @uses bbp_digest_load_textdomain() To load translation 
     19 * 
    1820 * @param array $sections existing sections 
    1921 * @return array $sections new sections 
    2022 */ 
    2123function bbp_digest_add_settings_section( $sections ) { 
     24    /* Load translations */ 
     25    bbp_digest_load_textdomain(); 
    2226    /* Append section to existing ones */ 
    2327    $sections['bbp_settings_digest'] = array( 
     
    3640 * @since 2.0 
    3741 * 
     42 * @uses bbp_digest_load_textdomain() To load translation 
     43 * 
    3844 * @param array $fields existing fields 
    3945 * @return array $fields new fields 
    4046 */ 
    4147function bbp_digest_add_settings_fields( $fields ) { 
     48    /* Load translations */ 
     49    bbp_digest_load_textdomain(); 
    4250    /* Append fields to existing ones */ 
    4351    $fields['bbp_settings_digest'] = array( 
     
    4654            'title'             => __( 'Show one-click subscription', 'bbp-digest' ), 
    4755            'callback'          => 'bbp_digest_admin_setting_callback_one_click', 
     56            'sanitize_callback' => 'intval', 
     57            'args'              => array() 
     58        ), 
     59        /* Weekly digest setting */ 
     60        '_bbp_digest_enable_weekly' => array( 
     61            'title'             => __( 'Show weekly digest option', 'bbp-digest' ), 
     62            'callback'          => 'bbp_digest_admin_setting_callback_weekly', 
    4863            'sanitize_callback' => 'intval', 
    4964            'args'              => array() 
     
    5974 * 
    6075 * @since 2.0 
     76 * 
     77 * @uses bbp_digest_load_textdomain() To load translation 
    6178 */ 
    6279function bbp_digest_admin_setting_callback_section() { 
     80    /* Load translations */ 
     81    bbp_digest_load_textdomain(); 
    6382    ?> 
    6483    <p><?php _e( 'bbPress Digest settings for enabling features', 'bbp-digest' ); ?></p> 
     
    7190 * @since 2.0 
    7291 * 
     92 * @uses bbp_digest_load_textdomain() To load translation 
    7393 * @uses checked() To display the checked attribute 
     94 * @uses bbp_digest_is_it_active() To check if feature is enabled 
    7495 */ 
    7596function bbp_digest_admin_setting_callback_one_click() { 
     97    /* Load translations */ 
     98    bbp_digest_load_textdomain(); 
    7699    ?> 
    77100    <input id="_bbp_digest_show_one_click" name="_bbp_digest_show_one_click" type="checkbox" id="_bbp_digest_show_one_click" value="1" <?php checked( bbp_digest_is_it_active( '_bbp_digest_show_one_click' ) ); ?> /> 
     
    79102    <?php 
    80103} 
     104 
     105/** 
     106 * Weekly digest setting field 
     107 * 
     108 * @since 2.0 
     109 * 
     110 * @uses bbp_digest_load_textdomain() To load translation 
     111 * @uses checked() To display the checked attribute 
     112 * @uses bbp_digest_is_it_active() To check if feature is enabled 
     113 */ 
     114function bbp_digest_admin_setting_callback_weekly() { 
     115    /* Load translations */ 
     116    bbp_digest_load_textdomain(); 
     117    ?> 
     118    <input id="_bbp_digest_enable_weekly" name="_bbp_digest_enable_weekly" type="checkbox" id="_bbp_digest_enable_weekly" value="1" <?php checked( bbp_digest_is_it_active( '_bbp_digest_enable_weekly' ) ); ?> /> 
     119    <label for="_bbp_digest_enable_weekly"><?php _e( 'Allow users to chose do they want to receive digest once weekly instead of once daily', 'bbp-digest' ); ?></label> 
     120    <?php 
     121} 
  • bbpress-digest/trunk/inc/bbp-profile.php

    r512544 r575479  
    1515 * 
    1616 * @since 1.0 
     17 * 
     18 * @uses bbp_get_displayed_user_id() To get ID of user that's edited 
     19 * @uses get_user_meta() To get user's digest settings 
     20 * @uses wp_print_scripts() To load jQuery file 
     21 * @uses bbp_digest_is_it_active() To check if feature is enabled 
     22 * @uses checked() To display the checked attribute 
     23 * @uses selected() To display the selected attribute 
     24 * @uses esc_attr() To escape element's attribute value 
     25 * @uses wp_locale::get_weekday To display days name 
     26 * @uses date_i18n() To get localized time & date 
     27 * @uses bbp_digest_get_dropdown() To get forums dropdown 
    1728 */ 
    1829function bbp_digest_display_bbp_profile_fields() { 
     
    2132 
    2233    /* Get user's settings */ 
    23     $bbp_digest_time = get_user_meta( $user_id, 'bbp_digest_time', true ); 
     34    $bbp_digest_time   = get_user_meta( $user_id, 'bbp_digest_time', true ); 
     35    $bbp_digest_day    = get_user_meta( $user_id, 'bbp_digest_day', true ); 
    2436    $bbp_digest_forums = get_user_meta( $user_id, 'bbp_digest_forums', true ); 
     37 
     38    /* Workaround when day is Sunday */ 
     39    if ( '0' === $bbp_digest_day ) 
     40        $bbp_digest_day = 'Sunday fix'; 
    2541 
    2642    /* Load jQuery */ 
     
    2844    ?> 
    2945    <style type="text/css"> 
    30     #content #bbp-your-profile fieldset #bbp-digest-check-row label, #content #bbp-your-profile fieldset #bbp-digest-pool-row label, #container #bbp-your-profile fieldset #bbp-digest-check-row label, #container #bbp-your-profile fieldset #bbp-digest-pool-row label { 
     46    #content #bbp-your-profile fieldset #bbp-digest-check-row label, #content #bbp-your-profile fieldset #bbp-digest-pool-row label, #content #bbp-your-profile fieldset #bbp-digest-day-row label, #container #bbp-your-profile fieldset #bbp-digest-check-row label, #container #bbp-your-profile fieldset #bbp-digest-pool-row label, #container #bbp-your-profile fieldset #bbp-digest-day-row label { 
    3147        float: none; 
    3248        width: 210px; 
     
    3551        line-height: 0; 
    3652    } 
    37     #content #bbp-your-profile fieldset #bbp-digest-pool-selection label, #container #bbp-your-profile fieldset #bbp-digest-pool-selection label { 
     53    #content #bbp-your-profile fieldset #bbp-digest-pool-selection label, #container #bbp-your-profile fieldset #bbp-digest-pool-selection label, #content #bbp-your-profile fieldset #bbp-digest-day-selection label, #container #bbp-your-profile fieldset #bbp-digest-day-selection label { 
    3854        width: 195px; 
    3955    } 
    40     #content #bbp-your-profile fieldset #bbp-digest-forum-list label, #container #bbp-your-profile fieldset #bbp-digest-forum-list label { 
     56    #content #bbp-your-profile fieldset #bbp-digest-forum-list label, #container #bbp-your-profile fieldset #bbp-digest-forum-list label, #content #bbp-your-profile fieldset #bbp-digest-day-list select, #container #bbp-your-profile fieldset #bbp-digest-day-list select { 
    4157        display:inline; 
    4258        margin-left: 170px; 
     
    5773        </div> 
    5874 
     75        <?php 
     76        if ( bbp_digest_is_it_active( '_bbp_digest_enable_weekly' ) ) : 
     77        ?> 
     78        <div id="bbp-digest-day-row"> 
     79            <div id="bbp-digest-when-selection"> 
     80            <label for="bbp-digest-when-daily"><input name="bbp-digest-when" id="bbp-digest-when-daily" type="radio" value="daily" <?php checked( ! $bbp_digest_day, true ); ?> /><?php _ex( 'Daily', 'radio button label', 'bbp-digest' ) ?> </label> 
     81            <label for="bbp-digest-when-weekly"><input name="bbp-digest-when" id="bbp-digest-when-weekly" type="radio" value="weekly" <?php checked( ! $bbp_digest_day, false ); ?> /><?php _ex( 'Weekly', 'radio button label', 'bbp-digest' ) ?> </label><br /> 
     82            <span class="description"><?php _e( 'Choose should you receive digest once daily or once weekly.', 'bbp-digest' ) ?></span><br /> 
     83            </div> 
     84 
     85            <div id="bbp-digest-day-list"> 
     86            <select name="bbp-digest-day" id="bbp-digest-day"> 
     87            <?php 
     88            /* Workaround when day is Sunday */ 
     89            if ( 'Sunday fix' == $bbp_digest_day ) 
     90                $bbp_digest_day = 0; 
     91 
     92            global $wp_locale; 
     93            for ( $day_index = 0; $day_index <= 6; $day_index++ ) : 
     94                ?> 
     95                <option value="<?php echo esc_attr( $day_index ); ?>" <?php selected( $bbp_digest_day, $day_index ); ?>><?php echo $wp_locale->get_weekday( $day_index ); ?></option> 
     96                <?php 
     97            endfor; 
     98            ?> 
     99            </select> 
     100            <span class="description"><?php _e( 'Choose on which day of a week you want to receive a digest.', 'bbp-digest' ) ?></span> 
     101            </div> 
     102        </div> 
     103        <?php 
     104        endif; 
     105        ?> 
     106 
    59107        <div id="bbp-digest-time-row"> 
    60             <label for="bbp-digest-time"><?php _e( 'Daily digests should be sent at this time:', 'bbp-digest' ) ?> </label> 
     108            <label for="bbp-digest-time"><?php _e( 'Digests should be sent at this time:', 'bbp-digest' ) ?> </label> 
    61109            <select name="bbp-digest-time" id="bbp-digest-time"> 
    62110                <?php for ( $i = 0; $i <= 23; $i++ ) : ?> 
     
    89137    <script type="text/javascript"> 
    90138        jQuery(document).ready(function($) { 
    91             /* If not subscribed, hide time dropdown & forum selection */ 
     139            /* If not subscribed, hide time dropdown, period & forum selections, & disable inputs */ 
    92140            if ( false == $('input#bbp-digest-subscription').is(':checked') ) { 
     141                $('#bbp-digest-day-row').hide(); 
    93142                $('#bbp-digest-time-row').hide(); 
    94143                $('#bbp-digest-pool-row').hide(); 
     144 
     145                $('#bbp-digest-time').attr("disabled",true); 
     146                $('#bbp-digest-day-list #bbp-digest-day').attr("disabled",true); 
     147                $('#bbp-digest-forum-list input').attr("disabled",true); 
    95148            } 
    96149 
    97             /* On subscription state change, show/hide dropdown & forum selection, and enable/disable inputs */ 
     150            /* On subscription state change, show/hide dropdown & period & forum selection, and enable/disable inputs */ 
    98151            $('input#bbp-digest-subscription').click(function() { 
    99152                if ( $(this).is(':checked') ) { 
     153                    $('#bbp-digest-day-row').show(); 
    100154                    $('#bbp-digest-time-row').show(); 
    101155                    $('#bbp-digest-pool-row').show(); 
     
    105159                        $('#bbp-digest-forum-list input').attr("disabled",false); 
    106160                    } 
     161                    if ( $('#bbp-digest-when-weekly').is(':checked') ) { 
     162                        $('#bbp-digest-day-list #bbp-digest-day').attr("disabled",false); 
     163                    } 
    107164                } else { 
     165                    $('#bbp-digest-day-row').hide(); 
    108166                    $('#bbp-digest-time-row').hide(); 
    109167                    $('#bbp-digest-pool-row').hide(); 
    110168 
    111169                    $('#bbp-digest-time').attr("disabled",true); 
     170                    $('#bbp-digest-day-list #bbp-digest-day').attr("disabled",true); 
    112171                    $('#bbp-digest-forum-list input').attr("disabled",true); 
    113172                } 
    114173            }); 
    115174 
    116             /* If subscribed to all, hide forum list */ 
     175            /* If subscribed to daily, hide day list & disable it */ 
     176            if ( $('input#bbp-digest-when-daily').is(':checked') ) { 
     177                $('#bbp-digest-day-list').hide(); 
     178                $('#bbp-digest-day-list #bbp-digest-day').attr("disabled",true); 
     179            } 
     180 
     181            /* On subscription when state change, show/hide day list, and enable/disable inputs */ 
     182            $('#bbp-digest-when-selection input:radio').click(function() { 
     183                /* Get id of selected option */ 
     184                var currentId = $(this).attr('id'); 
     185 
     186                if ( 'bbp-digest-when-weekly' == currentId ) { 
     187                    $('#bbp-digest-day-list').show(); 
     188                    $('#bbp-digest-day-list #bbp-digest-day').attr("disabled",false); 
     189                } else { 
     190                    $('#bbp-digest-day-list').hide(); 
     191                    $('#bbp-digest-day-list #bbp-digest-day').attr("disabled",true); 
     192                } 
     193            }); 
     194 
     195            /* If subscribed to all, hide forum list & disable it */ 
    117196            if ( $('input#bbp-digest-pool-all').is(':checked') ) { 
    118197                $('#bbp-digest-forum-list').hide(); 
     198                $('#bbp-digest-forum-list input').attr("disabled",true); 
    119199            } 
    120200 
  • bbpress-digest/trunk/inc/event.php

    r512544 r575479  
    1515 * 
    1616 * @since 1.0 
     17 * 
     18 * @uses BBP_Digest_Event Class that handles process 
    1719 */ 
    1820function bbp_digest_do_event() { 
    19  
    20     /* Get current time */ 
    21     $current_time = current_time( 'timestamp' ); 
    22  
    23     /* Get minutes passed since full hour */ 
    24     $current_minute = date( 'i', $current_time ); 
    25  
    26     /* Count number of minutes passed since full hour, plus seconds */ 
    27     if ( $current_minute > 00 ) { 
    28         $seconds_late = ( $current_minute * 60 ) + date( 's', $current_time ); 
    29     } else { 
    30         $seconds_late = date( 's', $current_time ); 
     21    $bbp_digest_event = new BBP_Digest_Event(); 
     22    $bbp_digest_event->do_event(); 
     23} 
     24 
     25/** 
     26 * Send digest emails on schedule 
     27 *  
     28 * @since 2.0 
     29 */ 
     30class BBP_Digest_Event { 
     31 
     32    /** 
     33     * Curent unix time 
     34     * 
     35     * @var $current_time 
     36     * @since 2.0  
     37     * @access private 
     38     */ 
     39    private $current_time; 
     40 
     41    /** 
     42     * Minutes passed since full hour 
     43     * 
     44     * @var $current_minute 
     45     * @since 2.0  
     46     * @access private 
     47     */ 
     48    private $current_minute; 
     49 
     50    /** 
     51     * Seconds passed since full hour 
     52     * 
     53     * @var $seconds_late 
     54     * @since 2.0  
     55     * @access private 
     56     */ 
     57    private $seconds_late; 
     58 
     59    /** 
     60     * Unix time 24 hours ago 
     61     * 
     62     * @var $yesterday_time 
     63     * @since 2.0  
     64     * @access private 
     65     */ 
     66    private $yesterday_time; 
     67 
     68    /** 
     69     * Unix time 7 days ago 
     70     * 
     71     * @var $week_ago_time 
     72     * @since 2.0  
     73     * @access private 
     74     */ 
     75    private $week_ago_time; 
     76 
     77    /** 
     78     * Numeric representation of the day of the week 
     79     * 
     80     * @var $current_day_of_week  
     81     * @since 2.0  
     82     * @access private 
     83     */ 
     84    private $current_day_of_week; 
     85 
     86    /** 
     87     * Sets class properties. 
     88     *  
     89     * @since 2.0 
     90     * @access public 
     91     */ 
     92    public function __construct() { 
     93 
     94        /* Set variables */ 
     95 
     96        /* Get current time */ 
     97        $this->current_time = current_time( 'timestamp' ); 
     98 
     99        /* Get minutes passed since full hour */ 
     100        $this->current_minute = date( 'i', $this->current_time ); 
     101 
     102        /* Count number of minutes passed since full hour, plus seconds */ 
     103        if ( $this->current_minute > 00 ) 
     104            $this->seconds_late = ( $this->current_minute * 60 ) + date( 's', $this->current_time ); 
     105        else 
     106            $this->seconds_late = date( 's', $this->current_time ); 
     107 
     108        /* Get yesterday's time */ 
     109        $this->yesterday_time = $this->current_time - ( ( 24 * 3600 ) + $this->seconds_late ); 
     110 
     111        /* Get week ago time */ 
     112        $this->week_ago_time = $this->current_time - ( ( 7 * 24 * 3600 ) + $this->seconds_late ); 
     113 
     114        /* Get current day of the week */ 
     115        $this->current_day_of_week = date( 'w', $this->current_time ); 
    31116    } 
    32117 
    33     /* Get yesterday's time */ 
    34     $yesterday_time = $current_time - ( ( 24 * 3600 ) + $seconds_late ); 
    35  
    36     /* Setup arguments for user query */ 
    37     $user_args = array( 
    38         'meta_key'   => 'bbp_digest_time', 
    39         'meta_value' => date( 'H', $current_time ), // Only users that should receive in this hour 
    40     ); 
    41  
    42     /* Query users */ 
    43     $users = get_users( $user_args ); 
    44  
    45     /* Only proceed further if there are users */ 
    46     if ( $users ) { 
    47  
     118    /** 
     119     * Process sending of digest emails 
     120     * 
     121     * @since 2.0 
     122     * @access public 
     123     * 
     124     * @uses get_users() To get users that should receive digest 
     125     * @uses BBP_Digest_Event::get_topics() To get topics IDs 
     126     * @uses apply_filters() Calls 'bbp_digest_time_border' with the time 
     127     *                        border for digest email title 
     128     * @uses bbp_get_topic_title() To get title of the topic 
     129     * @uses bbp_get_topic_last_reply_url() To get URL of topic's last reply 
     130     * @uses get_user_meta() To get user's digest settings 
     131     * @uses bbp_get_topic_forum_id() To get ID of topic's forum 
     132     * @uses wp_mail() To send digest email 
     133     * 
     134     * @param string $period Period for which digest are sent 
     135     */ 
     136    public function do_event( $period = 'day' ) { 
     137        /* Setup arguments for user query */ 
     138        $user_args = array( 
     139            'meta_key'   => 'bbp_digest_time', 
     140            'meta_value' => date( 'H', $this->current_time ), // Only users that should receive in this hour 
     141        ); 
     142 
     143        /* Query users */ 
     144        $users = get_users( $user_args ); 
     145 
     146        /* Only proceed further if there are users */ 
     147        if ( $users ) { 
     148 
     149            /* Set to false are there weekly subscribers */ 
     150            $have_for_weekly = false; 
     151 
     152            /* Query topics */ 
     153            $topic_ids = $this->get_topics( $period ); 
     154 
     155            /* Only proceed further if there are topics */ 
     156            if ( $topic_ids ) { 
     157                 
     158                /* Setup texts based on period  */ 
     159                if ( 'week' == $period ) { 
     160                    /* Set subject of email */ 
     161                    $subject = sprintf( __( 'Active topics for week ending %1$s', 'bbp-digest' ), date_i18n( _x( 'd. F Y.', 'week span email title date format', 'bbp-digest' ), $this->current_time ) ); 
     162 
     163                    /* Set standard message intro */ 
     164                    $message = __( "This topics have been active in the last 7 days:\n\n", "bbp-digest" ); 
     165                } else { 
     166                    /* Set subject of email based on current time */ 
     167                    if ( date( 'G', $this->current_time ) < apply_filters( 'bbp_digest_time_border', 8 ) ) { // If before 08:00, use yesterday 
     168                        $subject = sprintf( __( 'Active topics for %1$s', 'bbp-digest' ), date_i18n( _x( 'd. F Y.', 'one day span email title date format', 'bbp-digest' ), $this->yesterday_time ) ); 
     169                    } else { // Otherwise, use both 
     170                        $subject = sprintf( _x( 'Active topics for %1$s / %2$s', '1. Yesterday 2. Today', 'bbp-digest' ), date_i18n( _x( 'd. F Y.', 'two day span yesterday email title date format', 'bbp-digest' ), $this->yesterday_time ), date_i18n( _x( 'd. F Y.', 'one day span today email title date format', 'bbp-digest' ), $this->current_time ) ); 
     171                    } 
     172 
     173                    /* Set standard message intro */ 
     174                    $message = __( "This topics have been active in the last 24 hours:\n\n", "bbp-digest" ); 
     175                } 
     176                 
     177                /* Set list item placeholder; used because of new line (\n) */ 
     178            $item_placeholder = _x( '%1$s: %2$s 
     179', '1. Topic title 2. Topic URL', 'bbp-digest' ); 
     180 
     181                /* Setup list of topics */ 
     182                $all_topics_list = ''; 
     183 
     184                /* Go through all topics */ 
     185                foreach ( $topic_ids as $topic_id ) { 
     186                    $all_topics_list .= sprintf( $item_placeholder, bbp_get_topic_title( $topic_id ), bbp_get_topic_last_reply_url( $topic_id ) ); 
     187                } 
     188 
     189                /* Go through all users */ 
     190                foreach ( $users as $user ) { 
     191                    /* Get weekly subscription status */ 
     192                    $user_day = get_user_meta( $user->ID, 'bbp_digest_day', true ); 
     193 
     194                    /* Continue if user not from this period */ 
     195                    if ( 'day' == $period ) { 
     196                        /* Is weekly subscriber? Pay attention to Sunday. */ 
     197                        if ( strlen( $user_day ) > 0 ) { 
     198                            /* Set that there are subscribers for weekly */ 
     199                            $have_for_weekly = true; 
     200                            /* Continue to the next */ 
     201                            continue; 
     202                        } 
     203 
     204                    } 
     205 
     206                    /* Continue if user not from this day */ 
     207                    if ( 'week' == $period && $user_day != $this->current_day_of_week ) 
     208                        continue; 
     209 
     210                    /* If user folows only selected forums, loop all topics again */ 
     211                    if ( $user_forums = get_user_meta( $user->ID, 'bbp_digest_forums', true ) ) { 
     212 
     213                        /* Get string name of forum array, used for reducing duplication */ 
     214                        $topic_list = md5( serialize( $user_forums ) ); 
     215 
     216                        /* Check if topic list is already created & send it, otherwise create it & send it */ 
     217                        if ( $$topic_list ) { 
     218                            /* Send notification email */ 
     219                            wp_mail( $user->user_email, $subject, $message . $$topic_list ); 
     220                        } else { 
     221                            /* Setup list of topics */ 
     222                            $$topic_list = ''; 
     223 
     224                            /* Go through all topics */ 
     225                            foreach ( $topic_ids as $topic_id ) { 
     226                                /* Is topic from forum user selected? */ 
     227                                if ( in_array( bbp_get_topic_forum_id( $topic_id ), $user_forums ) ) { 
     228                                    $$topic_list .= sprintf( $item_placeholder, bbp_get_topic_title( $topic_id ), bbp_get_topic_last_reply_url( $topic_id ) ); 
     229                                } 
     230                            } 
     231 
     232                            /* Send notification email */ 
     233                            wp_mail( $user->user_email, $subject, $message . $$topic_list ); 
     234                        } 
     235                    /* Otherwise, send all topics */ 
     236                    } else { 
     237                        /* Send notification email */ 
     238                        wp_mail( $user->user_email, $subject, $message . $all_topics_list ); 
     239                    } 
     240                } 
     241            } 
     242 
     243            /* If this was for day, and there are for week, process them too */ 
     244            if ( 'day' == $period && $have_for_weekly ) 
     245                $this->do_event( 'week' ); 
     246        } 
     247    } 
     248 
     249    /** 
     250     * Get active topics for period. 
     251     * 
     252     * @since 2.0 
     253     * @access private 
     254     * 
     255     * @uses bbp_get_topic_post_type() To get topic post type name 
     256     * @uses bbp_get_public_status_id() To get post public status name 
     257     * @uses bbp_get_closed_status_id() To get post closed status name 
     258     * @uses get_posts() To get topics IDs 
     259     * 
     260     * @param string $period Period for which topics are queried 
     261     * @return array $topics List of topics IDs  
     262     */ 
     263    private function get_topics( $period = 'day' ) { 
    48264        /* Setup topic IDs array */ 
    49265        $topic_ids = array(); 
    50266 
    51         /* Setup arguments for topic query*/ 
     267        /* Setup time that we compare to */ 
     268        if ( 'week' == $period ) 
     269            $time = $this->week_ago_time; 
     270        else 
     271            $time = $this->yesterday_time; 
     272 
     273        /* Setup arguments for topic query */ 
    52274        $topic_args = array( 
    53275            'post_type'      => bbp_get_topic_post_type(), // Only bbPress topic type 
    54276            'posts_per_page' => -1, // All topics 
    55277            'meta_key'       => '_bbp_last_active_time', 
     278            'fields'         => 'ids', 
    56279            'orderby'        => 'meta_value', // Order by _bbp_last_active_time (ie. from newest to oldest) 
    57280            'post_status'    => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ), // All public statuses 
     
    59282                array( 
    60283                    'key' => '_bbp_last_active_time', 
    61                     'value' => date( 'Y-m-d H:i:s', $yesterday_time ), // Only active last 24 hours, plus passed time since full hour 
     284                    'value' => date( 'Y-m-d H:i:s', $time ), // Only active for period we are quering, last 24 hours or last 7 days, plus passed time since full hour 
    62285                    'compare' => '>', 
    63286                    'type' => 'DATETIME', 
     
    70293 
    71294        /* Only proceed further if there are topics */ 
    72         if ( $topics ) { 
    73  
    74             /* Add topics IDs to array */ 
    75             foreach ( $topics as $topic ) { 
    76                 $topic_ids[] = $topic->ID; 
    77             } 
    78  
    79             /* Set subject of email based on current time */ 
    80             if ( date( 'G', $current_time ) < apply_filters( 'bbp_digest_time_border', 8 ) ) { // If before 08:00, use yesterday 
    81                 $subject = sprintf( __( 'Active topics for %1$s', 'bbp-digest' ), date_i18n( _x( 'd. F Y.', 'one day span email title date format', 'bbp-digest' ), $yesterday_time ) ); 
    82             } else { // Otherwise, use both 
    83                 $subject = sprintf( _x( 'Active topics for %1$s / %2$s', '1. Yesterday 2. Today', 'bbp-digest' ), date_i18n( _x( 'd. F Y.', 'two day span yesterday email title date format', 'bbp-digest' ), $yesterday_time ), date_i18n( _x( 'd. F Y.', 'one day span today email title date format', 'bbp-digest' ), $current_time ) ); 
    84             } 
    85  
    86             /* Set standard message intro */ 
    87             $message = __( "This topics have been active in the last 24 hours:\n\n", "bbp-digest" ); 
    88  
    89             /* Set list item placeholder; used because of new line (\n) */ 
    90             $item_placeholder = _x( '%1$s: %2$s 
    91 ', '1. Topic title 2. Topic URL', 'bbp-digest' ); 
    92  
    93             /* Setup list of topics */ 
    94             $all_topics_list = ''; 
    95  
    96             /* Go through all topics */ 
    97             foreach ( $topic_ids as $topic_id ) { 
    98                 $all_topics_list .= sprintf( $item_placeholder, bbp_get_topic_title( $topic_id ), bbp_get_topic_last_reply_url( $topic_id ) ); 
    99             } 
    100  
    101             /* Go through all users */ 
    102             foreach ( $users as $user ) { 
    103  
    104                 /* If user folows only selected forums, loop all topics again */ 
    105                 if ( $user_forums = get_user_meta( $user->ID, 'bbp_digest_forums', true ) ) { 
    106  
    107                     /* Get string name of forum array, used for reducing duplication */ 
    108                     $topic_list = md5( serialize( $user_forums ) ); 
    109  
    110                     /* Check if topic list already created and send it, otherwise create it & send it */ 
    111                     if ( $$topic_list ) { 
    112                         /* Send notification email */ 
    113                         wp_mail( $user->user_email, $subject, $message . $$topic_list ); 
    114                     } else { 
    115                         /* Setup list of topics */ 
    116                         $$topic_list = ''; 
    117  
    118                         /* Go through all topics */ 
    119                         foreach ( $topic_ids as $topic_id ) { 
    120                             /* Is topic from forum user selected? */ 
    121                             if ( in_array( bbp_get_topic_forum_id( $topic_id ), $user_forums ) ) { 
    122                                 $$topic_list .= sprintf( $item_placeholder, bbp_get_topic_title( $topic_id ), bbp_get_topic_last_reply_url( $topic_id ) ); 
    123                             } 
    124                         } 
    125  
    126                         /* Send notification email */ 
    127                         wp_mail( $user->user_email, $subject, $message . $$topic_list ); 
    128                     } 
    129                 /* Otherwise, send all topics */ 
    130                 } else { 
    131                     /* Send notification email */ 
    132                     wp_mail( $user->user_email, $subject, $message . $all_topics_list ); 
    133                 } 
    134             } 
    135         } 
     295        if ( $topics ) 
     296            return $topics; 
     297        else 
     298            return; 
    136299    } 
    137300} 
  • bbpress-digest/trunk/inc/forums-list.php

    r512544 r575479  
    1717 * 
    1818 * @since 1.0 
     19 * 
     20 * @uses Walker 
    1921 */ 
    2022class BBP_Digest_Walker_Checkboxes extends Walker { 
     
    4143     * 
    4244     * @since 1.0 
     45     * 
     46     * @uses bbp_get_forum_post_type() To get forum post type name 
    4347     */ 
    4448    function BBP_Digest_Walker_Checkboxes() { 
  • bbpress-digest/trunk/inc/one-click-handle.php

    r573501 r575479  
    1515 * 
    1616 * @since 2.0 
     17 * 
     18 * @uses bbp_get_current_user_id() To get ID of current user 
     19 * @uses current_user_can() To check if the current user can edit user 
     20 * @uses bbp_get_forum() To get forum's data 
     21 * @uses check_ajax_referer() To check nonce 
     22 * @uses get_user_meta() To get user's digest settings 
     23 * @uses current_time() To get current UNIX time 
     24 * @uses add_user_meta() To save user's setting 
     25 * @uses update_user_meta() To update user's setting 
     26 * @uses delete_user_meta() To delete user's setting 
    1727 */ 
    1828 function bbp_digest_do_one_click_ajax_handle() { 
     
    93103            delete_user_meta( $user_id, $meta_key, $meta_value ); 
    94104    } 
    95      
     105 
    96106    die( '1' ); 
    97107} 
  • bbpress-digest/trunk/inc/one-click-template.php

    r573501 r575479  
    1515 * 
    1616 * @since 2.0 
     17 * 
     18 * @uses bbp_is_single_forum() To check if it's single forum 
     19 * @uses is_user_logged_in() To check if current visitor is logged in 
     20 * @uses bbp_get_current_user_id() To get ID of current user 
     21 * @uses get_user_meta() To get user's digest settings 
     22 * @uses bbp_get_forum_id() To get current forum's ID 
     23 * @uses bbp_get_user_profile_edit_url() To get URL of user's settings 
     24 * @uses wp_print_scripts() To load wpLists file 
     25 * @uses bbp_get_forum_permalink() To get URL of a forum 
     26 * @uses esc_url() To escape URL 
     27 * @uses wp_nonce_url() To add nonce to the URL 
     28 * @uses add_query_arg() To add query arguments to the URL 
    1729 */ 
    1830function bbp_digest_display_one_click_subscription() { 
     
    2537 
    2638    /* Get user's settings */ 
    27     $bbp_digest_time = get_user_meta( $user_id, 'bbp_digest_time', true ); 
     39    $bbp_digest_time   = get_user_meta( $user_id, 'bbp_digest_time',  true ); 
    2840    $bbp_digest_forums = get_user_meta( $user_id, 'bbp_digest_forums', true ); 
    2941 
  • bbpress-digest/trunk/inc/save-profile.php

    r512544 r575479  
    1515 * 
    1616 * @since 1.0 
     17 * 
     18 * @uses current_user_can() To check if the current user can edit user 
     19 * @uses get_user_meta() To get user's digest settings 
     20 * @uses add_user_meta() To save user's setting 
     21 * @uses update_user_meta() To update user's setting 
     22 * @uses delete_user_meta() To delete user's setting 
     23 * 
     24 * @param int $user_id ID of a user 
    1725 */ 
    1826function bbp_digest_do_save_profile_fields( $user_id ) { 
     
    2331    /* Prepare submitted values */ 
    2432    $bbp_digest_time = in_array( $_POST['bbp-digest-time'], range( 00, 23 ) ) ? $_POST['bbp-digest-time'] : ''; 
     33    $bbp_digest_day = in_array( $_POST['bbp-digest-day'], range( 0, 6 ) ) ? $_POST['bbp-digest-day'] : ''; 
    2534    $bbp_digest_forums = ''; 
    2635 
     
    3645        'bbp_digest_time' => $bbp_digest_time, 
    3746        'bbp_digest_forums' => $bbp_digest_forums, 
     47        'bbp_digest_day' => $bbp_digest_day, 
    3848    ); 
    3949 
     
    4454 
    4555        /* If a new meta value was added and there was no previous value, add it. */ 
    46         if ( $new_meta_value && '' == $meta_value ) 
     56        if ( isset( $new_meta_value ) && strlen( $new_meta_value ) > 0 && '' == $meta_value ) 
    4757            add_user_meta( $user_id, $meta_key, $new_meta_value, true ); 
    4858 
    4959        /* If the new meta value does not match the old value, update it. */ 
    50         elseif ( $new_meta_value && $new_meta_value != $meta_value ) 
     60        elseif ( isset( $new_meta_value ) && strlen( $new_meta_value ) > 0 && $new_meta_value != $meta_value ) 
    5161            update_user_meta( $user_id, $meta_key, $new_meta_value ); 
    5262 
    5363        /* If there is no new meta value but an old value exists, delete it. */ 
    54         elseif ( '' == $new_meta_value && $meta_value ) 
     64        elseif ( '' == $new_meta_value && isset( $meta_value ) && strlen( $meta_value ) > 0 ) 
    5565            delete_user_meta( $user_id, $meta_key, $meta_value ); 
    5666    } 
     67    /* Workaround when 0 is POSTed by tom {@link http://www.php.net/manual/en/types.comparisons.php#53926} */ 
    5768} 
  • bbpress-digest/trunk/inc/wp-profile.php

    r512544 r575479  
    1717 * 
    1818 * @since 1.0 
     19 * 
     20 * @uses get_user_meta() To get user's digest settings 
     21 * @uses wp_enqueue_script() To load jQuery file 
     22 * @uses bbp_digest_is_it_active() To check if feature is enabled 
     23 * @uses checked() To display the checked attribute 
     24 * @uses selected() To display the selected attribute 
     25 * @uses esc_attr() To escape element's attribute value 
     26 * @uses wp_locale::get_weekday To display days name 
     27 * @uses date_i18n() To get localized time & date 
     28 * @uses bbp_digest_get_dropdown() To get forums dropdown 
    1929 */ 
    2030function bbp_digest_display_profile_fields( $user ) { 
    2131    /* Get user's settings */ 
    22     $bbp_digest_time = get_user_meta( $user->ID, 'bbp_digest_time', true ); 
     32    $bbp_digest_time   = get_user_meta( $user->ID, 'bbp_digest_time',   true ); 
     33    $bbp_digest_day    = get_user_meta( $user->ID, 'bbp_digest_day',    true ); 
    2334    $bbp_digest_forums = get_user_meta( $user->ID, 'bbp_digest_forums', true ); 
     35 
     36    /* Workaround when day is Sunday */ 
     37    if ( '0' === $bbp_digest_day ) 
     38        $bbp_digest_day = 'Sunday fix'; 
    2439 
    2540    /* Load jQuery */ 
     
    3146 
    3247        <tr> 
    33             <th scope="row"><?php _e( 'Daily digest', 'bbp-digest' ) ?></th> 
     48            <th scope="row"><?php _ex( 'Digest emails', 'settings field label', 'bbp-digest' ) ?></th> 
    3449 
    3550            <td id="bbp-digest-subscription-cell"> 
     
    3954        </tr> 
    4055 
     56        <?php 
     57        if ( bbp_digest_is_it_active( '_bbp_digest_enable_weekly' ) ) : 
     58        ?> 
     59        <tr id="bbp-digest-day-row"> 
     60            <th scope="row"><?php _e( 'Daily or weekly', 'bbp-digest' ) ?></th> 
     61 
     62            <td> 
     63                <div id="bbp-digest-when-selection"> 
     64                <label for="bbp-digest-when-daily"><input name="bbp-digest-when" id="bbp-digest-when-daily" type="radio" value="daily" <?php checked( ! $bbp_digest_day, true ); ?> /><?php _ex( 'Daily', 'radio button label', 'bbp-digest' ) ?> </label> 
     65                <label for="bbp-digest-when-weekly"><input name="bbp-digest-when" id="bbp-digest-when-weekly" type="radio" value="weekly" <?php checked( ! $bbp_digest_day, false ); ?> /><?php _ex( 'Weekly', 'radio button label', 'bbp-digest' ) ?> </label><br /> 
     66                <span class="description"><?php _e( 'Choose should you receive digest once daily or once weekly.', 'bbp-digest' ) ?></span><br /> 
     67                </div> 
     68 
     69                <div id="bbp-digest-day-list"> 
     70                <select name="bbp-digest-day" id="bbp-digest-day"> 
     71                <?php 
     72                /* Workaround when day is Sunday */ 
     73                if ( 'Sunday fix' == $bbp_digest_day ) 
     74                    $bbp_digest_day = 0; 
     75 
     76                global $wp_locale; 
     77                for ( $day_index = 0; $day_index <= 6; $day_index++ ) : 
     78                    ?> 
     79                    <option value="<?php echo esc_attr( $day_index ); ?>" <?php selected( $bbp_digest_day, $day_index ); ?>><?php echo $wp_locale->get_weekday( $day_index ); ?></option> 
     80                    <?php 
     81                endfor; 
     82                ?> 
     83                </select> 
     84                <span class="description"><?php _e( 'Choose on which day of a week you want to receive a digest.', 'bbp-digest' ) ?></span> 
     85                </div> 
     86            </td> 
     87        </tr> 
     88        <?php 
     89        endif; 
     90        ?> 
     91 
    4192        <tr id="bbp-digest-time-row"> 
    42             <th scope="row"><?php _e( 'Daily digest time', 'bbp-digest' ) ?></th> 
     93            <th scope="row"><?php _e( 'Digest time', 'bbp-digest' ) ?></th> 
    4394 
    4495            <td id="bbp-digest-time-cell"> 
    45                 <label for="bbp-digest-time"><?php _e( 'Daily digests should be sent at this time:', 'bbp-digest' ) ?> </label> 
     96                <label for="bbp-digest-time"><?php _e( 'Digests should be sent at this time:', 'bbp-digest' ) ?> </label> 
    4697                <select name="bbp-digest-time" id="bbp-digest-time"> 
    4798                    <?php for ( $i = 0; $i <= 23; $i++ ) : ?> 
     
    55106 
    56107        <tr id="bbp-digest-pool-row"> 
    57             <th scope="row"><?php _e( 'Forums', 'bbp-digest' ) ?></th> 
     108            <th scope="row"><?php _ex( 'Forums', 'settings field label', 'bbp-digest' ) ?></th> 
    58109 
    59110            <td> 
     
    79130    <script type="text/javascript"> 
    80131        jQuery(document).ready(function($) { 
    81             /* If not subscribed, hide time dropdown & forum selection */ 
     132            /* If not subscribed, hide time dropdown, period & forum selections, & disable inputs */ 
    82133            if ( false == $('input#bbp-digest-subscription').is(':checked') ) { 
     134                $('#bbp-digest-day-row').hide(); 
    83135                $('#bbp-digest-time-row').hide(); 
    84136                $('#bbp-digest-pool-row').hide(); 
     137 
     138                $('#bbp-digest-time').attr("disabled",true); 
     139                $('#bbp-digest-day-list #bbp-digest-day').attr("disabled",true); 
     140                $('#bbp-digest-forum-list input').attr("disabled",true); 
    85141            } 
    86142 
    87             /* On subscription state change, show/hide dropdown & forum selection, and enable/disable inputs */ 
     143            /* On subscription state change, show/hide dropdown & period & forum selection, and enable/disable inputs */ 
    88144            $('input#bbp-digest-subscription').click(function() { 
    89145                if ( $(this).is(':checked') ) { 
     146                    $('#bbp-digest-day-row').show(); 
    90147                    $('#bbp-digest-time-row').show(); 
    91148                    $('#bbp-digest-pool-row').show(); 
     
    95152                        $('#bbp-digest-forum-list input').attr("disabled",false); 
    96153                    } 
     154                    if ( $('#bbp-digest-when-weekly').is(':checked') ) { 
     155                        $('#bbp-digest-day-list #bbp-digest-day').attr("disabled",false); 
     156                    } 
    97157                } else { 
     158                    $('#bbp-digest-day-row').hide(); 
    98159                    $('#bbp-digest-time-row').hide(); 
    99160                    $('#bbp-digest-pool-row').hide(); 
    100161 
    101162                    $('#bbp-digest-time').attr("disabled",true); 
     163                    $('#bbp-digest-day-list #bbp-digest-day').attr("disabled",true); 
    102164                    $('#bbp-digest-forum-list input').attr("disabled",true); 
    103165                } 
    104166            }); 
    105167 
    106             /* If subscribed to all, hide forum list */ 
     168            /* If subscribed to daily, hide day list & disable it */ 
     169            if ( $('input#bbp-digest-when-daily').is(':checked') ) { 
     170                $('#bbp-digest-day-list').hide(); 
     171                $('#bbp-digest-day-list #bbp-digest-day').attr("disabled",true); 
     172            } 
     173 
     174            /* On subscription when state change, show/hide day list, and enable/disable inputs */ 
     175            $('#bbp-digest-when-selection input:radio').click(function() { 
     176                /* Get id of selected option */ 
     177                var currentId = $(this).attr('id'); 
     178 
     179                if ( 'bbp-digest-when-weekly' == currentId ) { 
     180                    $('#bbp-digest-day-list').show(); 
     181                    $('#bbp-digest-day-list #bbp-digest-day').attr("disabled",false); 
     182                } else { 
     183                    $('#bbp-digest-day-list').hide(); 
     184                    $('#bbp-digest-day-list #bbp-digest-day').attr("disabled",true); 
     185                } 
     186            }); 
     187 
     188            /* If subscribed to all, hide forum list & disable it */ 
    107189            if ( $('input#bbp-digest-pool-all').is(':checked') ) { 
    108190                $('#bbp-digest-forum-list').hide(); 
     191                $('#bbp-digest-forum-list input').attr("disabled",true); 
    109192            } 
    110193 
Note: See TracChangeset for help on using the changeset viewer.