WordPress.org

Plugin Directory

Changeset 623777


Ignore:
Timestamp:
11/11/12 19:57:23 (17 months ago)
Author:
jmdodd
Message:

Minor bugfixes, getting ready for bbPress 2.2

Location:
bbpress-threaded-replies/trunk
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • bbpress-threaded-replies/trunk/css/bbpress-threaded-replies.css

    r601748 r623777  
    11/* Modifications for threading; tested under bbp-theme-compat and bbp-twentyten. */ 
    2 #content .replylist { 
     2#bbpress-forums div.reply.even div.even, 
     3#bbpress-forums div.reply.even ul.even, 
     4#bbpress-forums div.reply.even div.odd, 
     5#bbpress-forums div.reply.even ul.odd { 
     6    background-color: #fff; 
     7} 
     8 
     9#bbpress-forums div.reply.odd div.odd, 
     10#bbpress-forums div.reply.odd ul.odd, 
     11#bbpress-forums div.reply.odd div.even, 
     12#bbpress-forums div.reply.odd ul.even { 
     13    background-color: #fbfbfb; 
     14} 
     15 
     16#bbpress-forums .replylist { 
    317    list-style: none; 
    418    margin: 0; 
    519} 
    6 #content .replylist table, 
    7 #content .replylist tbody, 
    8 #content .replylist tr, 
    9 #content .replylist td { 
     20#bbpress-forums .replylist table, 
     21#bbpress-forums .replylist tbody, 
     22#bbpress-forums .replylist tr, 
     23#bbpress-forums .replylist td { 
    1024    border-collapse: collapse; 
    1125} 
    12 #content .replylist ul.children { 
     26#bbpress-forums .replylist ul.children { 
    1327    list-style: none; 
    1428    margin: 0 0 0 2.0em ; 
    1529} 
    16 #content .replylist li, 
    17 #content .replylist li div.reply { 
     30#bbpress-forums .replylist li, 
     31#bbpress-forums .replylist li div.reply { 
    1832    padding-bottom: 0; 
    1933} 
    20 #content table.bbp-replies, 
    21 #content .replylist table.bbp-replies { 
     34#bbpress-forums table.bbp-replies, 
     35#bbpress-forums .replylist table.bbp-replies { 
    2236    margin: -1px 0 0 0; 
    2337} 
    24 #content .replylist .ucc-bbp-in-reply-to { 
     38#bbpress-forums .replylist .ucc-bbp-in-reply-to { 
    2539    padding: 0 1.625em 1.625em 1.625em; 
    2640    border-top: 0px; 
    2741    text-align: right; 
    2842} 
    29 #content .replylist .bbp-reply-form { 
     43#bbpress-forums .replylist .bbp-reply-form { 
    3044    margin-bottom: 0; 
    3145    -moz-border-radius: 0px; 
     
    3549    position: relative; 
    3650} 
    37 #content .replylist #cancel-in-reply-to-link { 
     51#bbpress-forums .replylist #cancel-in-reply-to-link { 
    3852    position: absolute; 
    3953    right: 1.625em; 
     
    4862    text-transform: uppercase; 
    4963} 
    50 #content fieldset.bbp-form,  
     64#bbpress-forums fieldset.bbp-form,  
    5165#container fieldset.bbp-form,  
    5266#wrapper fieldset.bbp-form { 
  • bbpress-threaded-replies/trunk/includes/bbpress-threaded-replies.php

    r601748 r623777  
    1717 
    1818    public function init() { 
    19         // Input handling (metabox, reply input form). 
     19        // Input handling (metabox, reply input form) 
    2020        if ( is_admin() ) { 
    2121            add_action( 'bbp_reply_metabox', array( $this, 'extend_reply_metabox' ), 10, 1 ); 
     
    2626        } 
    2727 
    28         // bbPress action/filter hooks. 
     28        // bbPress action/filter hooks 
    2929        add_filter( 'bbp_has_replies', array( $this, 'has_replies' ), 10, 2 ); 
    3030        add_filter( 'bbp_new_reply_pre_set_terms', array( $this, 'save_post' ), 10, 3 ); 
     
    3333        add_filter( 'bbp_replies_pagination', array( $this, 'replies_pagination' ) ); 
    3434        add_filter( 'bbp_get_topic_pagination', array( $this, 'get_topic_pagination' ), 10, 2 ); 
     35        add_filter( 'bbp_get_topic_pagination_count', array( $this, 'get_topic_pagination_count' ) ); 
    3536        add_action( 'bbp_merge_topic', array( $this, 'merge_topic' ), 10, 2 ); 
    3637        add_action( 'bbp_pre_split_topic', array( $this, 'split_topic' ), 10, 3 );       
    3738 
    38         // Caching interactions. 
     39        // Caching interactions 
    3940        add_action( 'bbp_new_reply_pre_extras', array( $this, 'clean_cache' ) ); 
    4041        add_action( 'bbp_edit_reply_pre_extras', array( $this, 'clean_cache' ) ); 
     
    5758    } // init 
    5859 
    59     // Admin-side edit functionality and input handling. 
     60    // Admin-side edit functionality and input handling 
    6061    public function extend_reply_metabox( $reply_id ) { 
    6162        $value = absint( get_post_meta( $reply_id, '_ucc_btr_in_reply_to', true ) ); 
     
    7475        $in_reply_to = !empty( $_REQUEST['inreplyto'] ) ? (int) $_REQUEST['inreplyto'] : 0; 
    7576 
    76         // Trust but verify. 
     77        // Trust but verify 
    7778        if ( !isset( $_REQUEST['inreplyto_nonce'] ) ) 
    7879            return; 
     
    8384    } // extend_reply_attributes_metabox_save 
    8485 
    85     // Add hidden replyto form field and nonce to reply form. 
     86    // Add hidden replyto form field and nonce to reply form 
    8687    public function add_form_field() { 
    8788        if ( bbp_is_reply_edit() ) 
    8889            return; 
    8990 
    90         // We have to set this for non-JS replies. 
     91        // We have to set this for non-JS replies 
    9192        $in_reply_to = !empty( $_REQUEST['inreplyto'] ) ? (int) $_REQUEST['inreplyto'] : 0; 
    9293 
    93         // Trust but verify. 
     94        // Trust but verify 
    9495        if ( !isset( $_REQUEST['inreplyto_nonce'] ) ) { 
    9596            $in_reply_to = 0; 
     
    103104    } // add_form_field 
    104105 
    105     // Add cancel link to reply form. 
     106    // Add cancel link to reply form 
    106107    public function add_cancel_link() { 
    107108        if ( bbp_is_reply_edit() ) 
     
    111112    } // add_cancel_link 
    112113 
    113     // Set up replies for threading on bbPress has_replies(). 
     114    // Set up replies for threading on bbPress has_replies() 
    114115    public function has_replies( $have_posts, $reply_query ) { 
    115116        global $bbp, $wp_rewrite, $overridden_rpage; 
    116117 
    117118        if ( is_object( $bbp ) ) { 
    118             // bbPress version < 2.1 or already initialized. 
     119            // bbPress version < 2.1 or already initialized 
    119120        } elseif ( function_exists( 'bbpress' ) ) { 
    120121            $bbp = bbpress(); 
    121122        } 
    122123 
    123         // Heavy lifting for future calls. 
     124        // Heavy lifting for future calls 
    124125        $posts = $reply_query->posts; 
    125126        $replies = array(); 
    126127        if ( !empty( $posts ) ) { 
    127128            foreach( $posts as &$post ) { 
    128                 // Ignore the topic if included. 
     129                // Ignore the topic if included 
    129130                if ( bbp_get_reply_post_type() == $post->post_type ) { 
    130131                    $in_reply_to = get_post_meta( $post->ID, '_ucc_btr_in_reply_to', true ); 
     
    141142        $bbp->replies = $replies; 
    142143 
    143         // Set up based on options. 
     144        // Set up based on options 
    144145        $options = get_option( '_ucc_btr_options' ); 
    145146        $roots = ucc_btr_get_root_element_count( $bbp->current_topic_id ); 
     
    158159        $bbp->reply_query->max_num_pages = $max_num_pages; 
    159160 
    160         // Deal with reply pagination here. 
     161        // Deal with reply pagination here 
    161162        $topic_id = bbp_get_topic_id(); 
    162163        if ( $wp_rewrite->using_permalinks() ) 
     
    180181    } // has_replies 
    181182 
    182     // Add post_meta for in_reply_to on save. 
     183    // Add post_meta for in_reply_to on save 
    183184    public function save_post( $terms, $topic_id, $reply_id ) { 
    184185        $in_reply_to = !empty( $_REQUEST['inreplyto'] ) ? (int) $_REQUEST['inreplyto'] : 0; 
    185186 
    186         // Trust but verify. 
     187        // Trust but verify 
    187188        if ( !isset( $_REQUEST['inreplyto_nonce'] ) ) 
    188189            return; 
     
    195196    } // save_post 
    196197 
    197     // Reply URL for non-JS users. 
     198    // Reply URL for non-JS users 
    198199    public function reply_url( $url, $reply_id, $redirect_to ) { 
    199200        $reply = get_post( $reply_id ); 
     
    204205    } // reply_url 
    205206 
    206     // Return all replies if on a single topic view. 
    207     public function replies_per_page( $retval, $per ) { 
     207    // Return all replies if on a single topic view 
     208    public function replies_per_page( $retval, $default ) { 
    208209        if ( bbp_is_single_topic() && !( bbp_is_topic_merge() || bbp_is_topic_split() || bbp_is_topic_edit() ) ) 
    209210            return -1; 
     
    212213    } // replies_per_page 
    213214 
    214     // Pagination for threaded replies. 
     215    // Pagination for threaded replies 
    215216    public function replies_pagination( $args ) { 
    216217        global $wp_rewrite; 
     
    225226    } // replies_pagination 
    226227 
    227     // Fix topic pagination for display on forum pages. 
     228    // Fix topic pagination for display on forum pages 
    228229    public function get_topic_pagination( $links, $args ) { 
    229230        global $wp_rewrite; 
     
    272273    } // get_topic_pagination 
    273274 
    274     // Handle inheritance on merges. 
     275    // Remove topic pagination count for display on topic pages 
     276    // @todo Fix with actual numbers 
     277    public function get_topic_pagination_count( $retstr ) { 
     278        return '';  
     279    } // get_topic_pagination_count 
     280 
     281    // Handle inheritance on merges 
    275282    public function merge_topic( $destination_topic_id, $source_topic_id ) { 
    276283        $replies = (array) get_posts( array( 
     
    281288        ) ); 
    282289 
    283         // Clean up orphans by setting them as replies to the source topic. 
     290        // Clean up orphans by setting them as replies to the source topic 
    284291        if ( !empty( $replies ) ) { 
    285292            foreach ( $replies as $reply ) { 
     
    290297        } 
    291298 
    292         // Fix the source topic. 
     299        // Fix the source topic 
    293300        update_post_meta( $source_topic_id, '_ucc_btr_in_reply_to', '0' ); 
    294301    } // merge_topic 
    295302 
    296     // Handle inheritance on splits. 
     303    // Handle inheritance on splits 
    297304    public function split_topic( $from_reply_id, $source_topic_id, $destination_topic_id ) { 
    298305        global $wpdb; 
    299306        $from_reply = get_post( $from_reply_id ); 
    300307 
    301         // get_posts() is not used because it does not have the >= comparison for post_date. 
     308        // get_posts() is not used because it does not have the >= comparison for post_date 
    302309        $replies = (array) $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->posts} WHERE {$wpdb->posts}.post_date >= %s AND {$wpdb->posts}.post_parent = %d AND {$wpdb->posts}.post_type = %s ORDER BY {$wpdb->posts}.post_date ASC", $from_reply->post_date, $source_topic_id, bbp_get_reply_post_type() ) ); 
    303310 
    304         // Clean up orphans. 
     311        // Clean up orphans 
    305312        $ids = array(); 
    306313        if ( !empty( $replies ) && !is_wp_error( $replies ) ) { 
     
    310317                if ( !in_array( $in_reply_to, $ids ) ) 
    311318                    update_post_meta( $reply->ID, '_ucc_btr_in_reply_to', 0 ); 
    312                 // Special case for new topic from reply. 
     319                // Special case for new topic from reply 
    313320                if ( ( $from_reply_id == $destination_topic_id ) && ( $from_reply_id == $in_reply_to ) ) 
    314321                    update_post_meta( $reply->ID, '_ucc_btr_in_reply_to', 0 ); 
     
    316323        } 
    317324 
    318         // Fix the parent reply. 
     325        // Fix the parent reply 
    319326        update_post_meta( $from_reply_id, '_ucc_btr_in_reply_to', 0 ); 
    320327    } // split_topic 
    321328 
    322     // Tidy up topic information after major changes. 
     329    // Tidy up topic information after major changes 
    323330    public function clean_cache() { 
    324331        $group = 'ucc_btr'; 
     
    356363    } 
    357364 
    358     // Wipe cache completely (when settings change, etc.). 
     365    // Wipe cache completely (when settings change, etc.) 
    359366    public function clear_cache() { 
    360367        $group = 'ucc_btr'; 
  • bbpress-threaded-replies/trunk/includes/ucc-btr-callbacks.php

    r601748 r623777  
    55 
    66 
    7 // Default table-based callback (bbp-twentyten) for Walker_Comment. 
     7// Default table-based callback (bbp-twentyten) for Walker_Comment 
    88if ( !function_exists( 'ucc_btr_bbpress_reply_cb' ) ) { 
    99function ucc_btr_bbpress_reply_cb( $_reply, $args, $depth ) { 
     
    1111 
    1212    if ( is_object( $bbp ) ) { 
    13         // bbPress version < 2.1 or already initialized. 
     13        // bbPress version < 2.1 or already initialized 
    1414    } elseif ( function_exists( 'bbpress' ) ) { 
    1515        $bbp = bbpress(); 
     
    1919    $original_reply = $reply; 
    2020 
    21     // Force WordPress/bbPress functions to use the right reply. 
     21    // Force WordPress/bbPress functions to use the right reply 
    2222    $post = $_reply; 
    2323    $bbp->reply_query->post = $_reply; 
     
    5050 
    5151    <?php 
    52     // Restore order. 
     52    // Restore order 
    5353    $post = $original_post; 
    5454    $bbp->reply_query->post = $original_post; 
     
    6363 
    6464    if ( is_object( $bbp ) ) { 
    65         // bbPress version < 2.1 or already initialized. 
     65        // bbPress version < 2.1 or already initialized 
    6666    } elseif ( function_exists( 'bbpress' ) ) { 
    6767        $bbp = bbpress(); 
     
    7171    $original_reply = $reply; 
    7272 
    73     // Force WordPress/bbPress functions to use the right reply. 
     73    // Force WordPress/bbPress functions to use the right reply 
    7474    $post = $_reply; 
    7575    $bbp->reply_query->post = $_reply; 
     
    9797</div> 
    9898    <?php 
    99     // Restore order. 
     99    // Restore order 
    100100    $post = $original_post; 
    101101    $bbp->reply_query->post = $original_post; 
  • bbpress-threaded-replies/trunk/includes/ucc-btr-functions.php

    r601748 r623777  
    2626    global $wpdb; 
    2727 
    28     // Check cache first. 
     28    // Check cache first 
    2929    $group = 'ucc_btr'; 
    3030    $expires = ucc_btr_get_expires(); 
     
    5050    $post_status_in_array = implode( ',', $post_status_in_array ); 
    5151 
    52     // Direct SQL is more efficient than trying to use WP_Query here. 
     52    // Direct SQL is more efficient than trying to use WP_Query here 
    5353    $sql = $wpdb->prepare( " 
    5454        SELECT COUNT(*) FROM {$wpdb->posts} p 
     
    6868    $reply_count = (int) $wpdb->get_var( $sql ); 
    6969 
    70     // Populate cache. 
     70    // Populate cache 
    7171    $counts[$topic_id] = (int) $reply_count; 
    7272    wp_cache_set( $key, $counts, $group, $expires ); 
     
    7777 
    7878// Source: wp-includes/comment.php 
    79 // Derived from get_comment_pages_count(). 
     79// Derived from get_comment_pages_count() 
    8080if ( !function_exists( 'ucc_btr_get_reply_pages_count' ) ) { 
    8181function ucc_btr_get_reply_pages_count( $replies = null, $per_page = null, $threaded = null ) { 
     
    8383 
    8484    if ( is_object( $bbp ) ) { 
    85         // bbPress version < 2.1 or already initialized. 
     85        // bbPress version < 2.1 or already initialized 
    8686    } elseif ( function_exists( 'bbpress' ) ) { 
    8787        $bbp = bbpress(); 
     
    122122 
    123123// Source: wp-includes/comment.php 
    124 // Derived from get_page_of_comment(). 
     124// Derived from get_page_of_comment() 
    125125if ( !function_exists( 'ucc_btr_get_page_of_reply' ) ) { 
    126126function ucc_btr_get_page_of_reply( $reply_id, $all = false ) { 
     
    129129    $topic_id = bbp_get_reply_topic_id( $reply_id ); 
    130130 
    131     // Check for paging. 
     131    // Check for paging 
    132132    $options = get_option( '_ucc_btr_options' ); 
    133133    if ( !$options['page_replies'] ) 
    134134        return 1; 
    135135 
    136     // Check cache first. 
     136    // Check cache first 
    137137    $group = 'ucc_btr'; 
    138138    $expires = ucc_btr_get_expires(); 
     
    166166    $post_status_in_array = implode( ',', $post_status_in_array ); 
    167167 
    168     // Direct SQL is more efficient than trying to use WP_Query here. 
     168    // Direct SQL is more efficient than trying to use WP_Query here 
    169169    $sql = $wpdb->prepare( " 
    170170        SELECT COUNT(*) FROM {$wpdb->posts} p 
     
    185185    $previous = $wpdb->get_var( $sql ); 
    186186 
    187     // Calculate page. 
     187    // Calculate page 
    188188    $options = get_option( '_ucc_btr_options' ); 
    189189    $replies_per_page = $options['replies_per_page'];  
    190190    $page = ceil( ( $previous + 1 ) / $replies_per_page ); 
    191191 
    192         // Deal with $overridden_rpage. 
     192        // Deal with $overridden_rpage 
    193193        $options = get_option( '_ucc_btr_options' ); 
    194194        if ( array_key_exists( 'default_replies_page', $options ) && $options['default_replies_page'] == 'newest' ) { 
     
    197197        } 
    198198 
    199     // Populate cache. 
     199    // Populate cache 
    200200    $pages[$topic_id][$reply_id] = $page; 
    201201    wp_cache_set( $key, $pages, $group, $expires ); 
     
    206206 
    207207// Source: wp-includes/comment-template.php 
    208 // Derived from get_comment_link(). 
     208// Derived from get_comment_link() 
    209209if ( !function_exists( 'ucc_btr_get_reply_link' ) ) { 
    210210function ucc_btr_get_reply_link( $url, $reply_id, $redirect_to ) { 
     
    218218    $topic_url = remove_query_arg( 'view', $topic_url ); 
    219219 
    220     // Deal with pagination and permalink structure. 
     220    // Deal with pagination and permalink structure 
    221221    if ( 1 >= $reply_page ) { 
    222222        $url = user_trailingslashit( $topic_url ) . $reply_hash; 
     
    237237 
    238238// Source: wp-includes/comment-template.php 
    239 // Derived from get_comment_class(). 
     239// Derived from get_comment_class() 
    240240if ( !function_exists( 'ucc_btr_get_reply_class' ) ) { 
    241241function ucc_btr_get_reply_class( $class = '', $reply_id = null, $topic_id = null ) { 
     
    249249    $classes[] = 'reply'; 
    250250 
    251     // If the reply author is a user, print the cleaned user_nicename. 
     251    // If the reply author is a user, print the cleaned user_nicename 
    252252    if ( $reply->post_author > 0 && $user = get_userdata( $reply->post_author ) ) { 
    253         // For all registered users, 'byuser'. 
     253        // For all registered users, 'byuser' 
    254254        $classes[] = 'byuser'; 
    255255        $classes[] = 'reply-author-' . sanitize_html_class( $user->user_nicename, $reply->post_author ); 
    256         // For reply authors who are the author of the topic. 
     256        // For reply authors who are the author of the topic 
    257257        if ( $reply->post_author === $topic->post_author ) { 
    258258            $classes[] = 'bytopicauthor'; 
     
    276276    $reply_alt++; 
    277277 
    278     // Alt for top-level replies. 
     278    // Alt for top-level replies 
    279279    if ( 1 == $reply_depth ) { 
    280280        if ( $reply_thread_alt % 2 ) { 
     
    304304 
    305305// Source: wp-includes/comment-template.php 
    306 // Derived from comment_class(). 
     306// Derived from comment_class() 
    307307if ( !function_exists( 'ucc_btr_reply_class' ) ) { 
    308308function ucc_btr_reply_class( $class = '', $reply_id = null, $topic_id = null, $echo = true ) { 
     
    316316 
    317317// Source: wp-includes/comment-template.php 
    318 // Derived from get_comment_reply_link(). 
     318// Derived from get_comment_reply_link() 
    319319if ( !function_exists( 'ucc_btr_get_in_reply_to_link' ) ) { 
    320320function ucc_btr_get_in_reply_to_link( $args = array(), $_reply = null, $topic = null ) { 
     
    354354 
    355355// Source: wp-includes/comment-template.php 
    356 // Derived from comment_reply_link(). 
     356// Derived from comment_reply_link() 
    357357if ( !function_exists( 'ucc_btr_in_reply_to_link' ) ) { 
    358358function ucc_btr_in_reply_to_link( $args = array(), $reply = null, $topic = null ) { 
     
    362362 
    363363// Source: wp-includes/comment-template.php 
    364 // Derived from get_cancel_comment_reply_link(). 
     364// Derived from get_cancel_comment_reply_link() 
    365365if ( !function_exists( 'ucc_btr_get_cancel_in_reply_to_link' ) ) { 
    366366function ucc_btr_get_cancel_in_reply_to_link( $text = '' ) { 
     
    376376 
    377377// Source: wp-includes/comment-template.php 
    378 // Derived from get_cancel_comment_reply_link(). 
     378// Derived from get_cancel_comment_reply_link() 
    379379if ( !function_exists( 'ucc_btr_cancel_in_reply_to_link' ) ) { 
    380380function ucc_btr_cancel_in_reply_to_link( $text = '' ) { 
     
    384384 
    385385// Source: wp-includes/comment-template.php 
    386 // Derived from wp_list_comments(). 
     386// Derived from wp_list_comments() 
    387387if ( !function_exists( 'ucc_btr_list_replies' ) ) { 
    388388function ucc_btr_list_replies( $args = array(), $replies = null ) { 
     
    442442            $r['page'] = get_query_var( 'paged' ); 
    443443        } else { 
    444             // Handle $overridden_rpage here. 
     444            // Handle $overridden_rpage here 
    445445            $threaded = ( -1 != $r['max_depth'] ); 
    446446            $paged = get_query_var( 'paged' ); 
     
    452452    } 
    453453 
    454     // Validation check. 
     454    // Validation check 
    455455    $r['page'] = intval( $r['page'] ); 
    456456    if ( 0 == $r['page'] && 0 != $r['per_page'] ) 
  • bbpress-threaded-replies/trunk/readme.txt

    r607146 r623777  
    11=== bbPress Threaded Replies === 
    22Contributors: jmdodd 
    3 Tags: bbpress, replies, threaded, nested 
     3Tags: bbpress, replies, threaded, nested, hierarchical 
    44Requires at least: WordPress 3.4, bbPress 2.0 
    5 Tested up to: 3.4 
    6 Stable tag: 0.4.2 
     5Tested up to: 3.5-beta1, bbPress 2.2-beta2 
     6Stable tag: 0.4.3 
    77 
    88Add threaded (nested) reply functionality to bbPress. 
     
    1313and topic-display functions from bbPress. Settings can be adjusted on the bbPress 
    1414Forums options page of WordPress. bbPress running as a WordPress plugin is required.  
     15 
     16bbPress Threaded Replies is incompatible with the Fancy Editor; enabling threading will 
     17automatically disable the Fancy Editor. 
    1518 
    1619The plugin checks first in the stylesheet and template directories before reverting  
     
    2427 
    2528== Changelog == 
     29 
     30= 0.4.3 = 
     31* Move activation from init to plugins_loaded. 
     32* Improve CSS. 
     33* BuddyPress Group Forums compat.  
     34* Disable Fancy Editor when using threaded replies. 
     35* Remove "Viewing X replies" counts. 
    2636 
    2737= 0.4.2 = 
  • bbpress-threaded-replies/trunk/ucc-btr-loader.php

    r607146 r623777  
    33Plugin Name: bbPress Threaded Replies  
    44Description: Add threaded (nested) reply functionality to bbPress.  
    5 Version: 0.4.2 
     5Version: 0.4.3 
    66License: GPL 
    77Author: Jennifer M. Dodd 
     
    4343    public function __construct() { 
    4444        self::$instance = $this; 
    45         $this->version = '20121002'; 
     45        $this->version = '2012111101'; 
    4646        $this->plugin_dir   = plugin_dir_path( __FILE__ ); 
    4747        $this->plugin_url   = plugins_url( __FILE__ ); 
    4848        $this->template_dir = trailingslashit( $this->plugin_dir ) . 'templates'; 
    4949 
    50         // Languages. 
     50        // Languages 
    5151        load_plugin_textdomain( 'bbpress-threaded-replies', false, basename( dirname( __FILE__ ) ) . '/languages' ); 
    5252 
    53         // Default settings. 
     53        // Default settings 
    5454        $options = get_option( '_ucc_btr_options' ); 
    5555        if ( !$options ) { 
     
    6565        } 
    6666 
    67         // Admin-side plugin settings. 
     67        // Admin-side plugin settings 
    6868        if ( is_admin() ) 
    6969            add_action( 'bbp_admin_init', array( $this, 'register_admin_settings' ), 15 ); 
    7070 
    71         // Includes. 
     71        // Includes 
    7272        $this->includes(); 
    7373 
    74         // Load main. 
     74        // Load main 
    7575        if ( $options['thread_replies'] ) { 
    76             // Template and script handlers. 
     76            // Template and script handlers 
    7777            if ( function_exists( 'bbpress' ) ) { 
    78                   add_action( 'get_template_part_loop', array( $this, 'get_template_part' ), 10, 2 ); 
    79                   add_filter( 'bbp_get_template_part', array( $this, 'bbp_get_template_part' ), 10, 3 ); 
    80             } else { // bbPress < 2.1 compat. 
     78                add_action( 'get_template_part_loop', array( $this, 'get_template_part' ), 10, 2 ); 
     79                add_filter( 'bbp_get_template_part', array( $this, 'bbp_get_template_part' ), 10, 3 ); 
     80            } else { // bbPress < 2.1 compat 
    8181                add_action( 'template_redirect', array( $this, 'template_redirect' ), 15 ); 
    8282            } 
     83            add_filter( 'bbp_use_wp_editor', '__return_false' );  
    8384            add_action( 'wp_enqueue_scripts', array( $this, 'register_externals' ) ); 
    8485            add_action( 'wp_enqueue_scripts', array( $this, 'load_externals' ) ); 
     
    8788        } 
    8889 
    89         // Caching. 
     90        // Caching 
    9091        wp_cache_add_global_groups( 'ucc_btr' ); 
    9192    } // __construct 
    9293 
    93     // Includes. 
     94    // Includes 
    9495    public function includes() { 
    9596        require( $this->plugin_dir . 'includes/bbpress-threaded-replies.php' ); 
     
    9899    } // includes 
    99100 
    100     // Admin-side settings. 
     101    // Admin-side settings 
    101102    public function register_admin_settings() { 
    102103        add_settings_section( 'threaded_replies', __( 'Threaded Replies', 'bbpress-threaded-replies' ), array( $this, 'threaded_replies_text' ), 'bbpress' ); 
     
    175176    } // validate_settings 
    176177 
    177     // New way of doing this. 
     178    // New way of doing this 
    178179    public function get_template_part( $slug, $name ) { 
    179180        if ( $slug == 'loop' && $name == 'replies' && bbp_is_single_topic() && !bbp_is_topic_merge() && !bbp_is_topic_edit() && !bbp_is_topic_split() ) { 
    180             if ( bbp_is_theme_compat_active() ) 
     181            if ( bbp_is_theme_compat_active() || bbp_is_group_forums_active() && function_exists( 'bp_is_groups_component' ) && bp_is_groups_component() ) 
    181182                $template_name = 'bbpress/ucc-loop-compat.php'; 
    182183            else 
     
    196197                $located = trailingslashit( $this->template_dir ) . $template_name; 
    197198            } 
     199 
    198200            load_template( $located, true ); 
    199201        } 
     
    206208    } // bbp_get_template_part 
    207209 
    208     // bbPress 2.0 compat, simplified. 
     210    // bbPress 2.0 compat, simplified 
    209211    public function template_redirect() { 
    210212        if ( bbp_is_single_topic() && !bbp_is_topic_merge() && !bbp_is_topic_edit() && !bbp_is_topic_split() ) { 
     
    235237            wp_enqueue_script( 'bbpress-threaded-replies' ); 
    236238        } 
     239 
     240        // BuddyPress group forums 
     241        if ( bbp_is_group_forums_active() && function_exists( 'bp_is_groups_component' ) && bp_is_groups_component() && bp_action_variable( 0 ) == bbp_get_topic_post_type() ) { 
     242            wp_enqueue_style( 'bbpress-threaded-replies' ); 
     243            wp_enqueue_script( 'bbpress-threaded-replies' ); 
     244        } 
    237245    } // load_externals 
    238246} } 
    239247 
    240 // Only load if bbPress is active. 
     248 
     249// Only load if bbPress is active 
    241250function ucc_btr_loader() { 
    242251    if ( in_array( 'bbpress/bbpress.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) 
    243252        new UCC_bbPress_Threaded_Replies_Loader; 
    244253} 
    245 add_action( 'init', 'ucc_btr_loader' ); 
     254add_action( 'plugins_loaded', 'ucc_btr_loader' ); 
Note: See TracChangeset for help on using the changeset viewer.