Skip to:
Content

bbPress.org

Changeset 2565


Ignore:
Timestamp:
10/19/2010 06:19:12 AM (16 years ago)
Author:
johnjamesjacoby
Message:

Cleanup wp_debug errors. Fixes #1335, #1336, #1338, #1339, and #1340.

Location:
branches/plugin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-admin.php

    r2557 r2565  
    100100
    101101                // OK, we're authenticated: we need to find and save the data
    102                 $parent_id = $_POST['parent_id'];
     102                $parent_id = isset( $_POST['parent_id'] ) ? $_POST['parent_id'] : 0;
    103103
    104104                do_action( 'bbp_topic_parent_metabox_save' );
     
    140140
    141141                // OK, we're authenticated: we need to find and save the data
    142                 $parent_id = $_POST['parent_id'];
     142                $parent_id = isset( $_POST['parent_id'] ) ? $_POST['parent_id'] : 0;
    143143
    144144                do_action( 'bbp_topic_reply_parent_metabox_save' );
     
    153153         */
    154154        function admin_head () {
     155                global $wp_query;
     156
    155157                // Icons for top level admin menus
    156158                $menu_icon_url  = BBP_IMAGES_URL . '/menu.png';
    157159
    158160                // Top level menu classes
    159                 $forum_class       = sanitize_html_class( BBP_FORUM_POST_TYPE_ID );
    160                 $topic_class       = sanitize_html_class( BBP_TOPIC_POST_TYPE_ID );
     161                $forum_class = sanitize_html_class( BBP_FORUM_POST_TYPE_ID );
     162                $topic_class = sanitize_html_class( BBP_TOPIC_POST_TYPE_ID );
    161163                $reply_class = sanitize_html_class( BBP_REPLY_POST_TYPE_ID );
    162164
    163165                // Calculate offset for screen_icon sprite
    164                 $icons32_offset = -90 * array_search( $_GET['post_type'], array( BBP_FORUM_POST_TYPE_ID, BBP_TOPIC_POST_TYPE_ID, BBP_REPLY_POST_TYPE_ID ) );
     166                if ( bbp_is_forum() || bbp_is_topic() || bbp_is_reply() )
     167                        $icons32_offset = -90 * array_search( $_GET['post_type'], array( BBP_FORUM_POST_TYPE_ID, BBP_TOPIC_POST_TYPE_ID, BBP_REPLY_POST_TYPE_ID ) );
    165168
    166169?>
     
    262265                        'bbp_forum_topic_count'       => __( 'Topics', 'bbpress' ),
    263266                        'bbp_forum_topic_reply_count' => __( 'Replies', 'bbpress' ),
    264                         'author'                      => __( 'Author', 'bbpress' ),
     267                        'author'                      => __( 'Creator', 'bbpress' ),
    265268                        'date'                        => __( 'Date' , 'bbpress' )
    266269                );
    267                 return $columns;
     270
     271                return apply_filters( 'bbp_admin_forums_column_headers', $columns );
    268272        }
    269273       
     
    287291                        case 'bbp_forum_topic_reply_count' :
    288292                                bbp_forum_topic_reply_count();
     293                                break;
     294
     295                        default:
     296                                do_action( 'bbp_admin_forums_column_data', $column, $post_id );
    289297                                break;
    290298                }
     
    307315                        the_content();
    308316                }
     317
    309318                return $actions;
    310319        }
     
    329338                        'bbp_topic_freshness'   => __( 'Freshness', 'bbpress' )
    330339                );
    331                 return $columns;
     340
     341                return apply_filters( 'bbp_admin_topics_column_headers', $columns );
    332342        }
    333343
     
    370380                                bbp_topic_reply_count();
    371381                                break;
     382
    372383                        case 'bbp_topic_freshness':
    373384                                // Output last activity time and date
    374385                                bbp_get_topic_last_active();
     386                                break;
     387
     388                        default :
     389                                do_action( 'bbp_admin_topics_column_data', $column, $post_id );
    375390                                break;
    376391                }
  • branches/plugin/bbp-templatetags.php

    r2562 r2565  
    6767        $bbp_forums_template = new WP_Query( $r );
    6868
    69         return apply_filters( 'bbp_has_forums', $bbp_forums_template->have_posts(), &$bbp_forums_template );
     69        return apply_filters( 'bbp_has_forums', $bbp_forums_template->have_posts(), $bbp_forums_template );
    7070}
    7171
     
    134134
    135135                // Currently inside a forum loop
    136                 if ( isset( $bbp_forums_template->post ) )
     136                if ( isset( $bbp_forums_template->post->ID ) )
    137137                        $bbp_forum_id = $bbp_forums_template->post->ID;
    138138
     
    286286                        $forum_id = bbp_get_forum_id();
    287287
    288                 $forum_topics = get_pages( array( 'post_parent' => $forum_id, 'post_type' => BBP_TOPIC_POST_TYPE_ID ) );
    289 
    290                 return apply_filters( 'bbp_get_forum_topic_count', count( $forum_topics ) );
     288                $forum_topics = 0; //get_pages( array( 'post_parent' => $forum_id, 'post_type' => BBP_TOPIC_POST_TYPE_ID ) );
     289
     290                return apply_filters( 'bbp_get_forum_topic_count', $forum_topics );
    291291
    292292                //return apply_filters( 'bbp_get_forum_topic_count', (int)get_post_meta( $forum_id, 'bbp_forum_topic_count', true ) );
     
    351351                        $forum_id = bbp_get_forum_id();
    352352
    353                 $forum_topic_replies = get_pages( array( 'post_parent' => $forum_id, 'post_type' => BBP_REPLY_POST_TYPE_ID ) );
    354 
    355                 return apply_filters( 'bbp_get_forum_topic_reply_count', count( $forum_topic_replies, COUNT_RECURSIVE ) );
     353                $forum_topic_replies = 0; //get_pages( array( 'post_parent' => $forum_id, 'post_type' => BBP_REPLY_POST_TYPE_ID ) );
     354
     355                return apply_filters( 'bbp_get_forum_topic_reply_count', $forum_topic_replies );
    356356
    357357                //return apply_filters( 'bbp_get_forum_topic_reply_count', (int)get_post_meta( $forum_id, 'bbp_forum_topic_reply_count', true ) );
     
    457457
    458458        // Return object
    459         return apply_filters( 'bbp_has_topics', $bbp_topics_template->have_posts(), &$bbp_topics_template );
     459        return apply_filters( 'bbp_has_topics', $bbp_topics_template->have_posts(), $bbp_topics_template );
    460460}
    461461
     
    524524
    525525                // Currently inside a topic loop
    526                 if ( isset( $bbp_topics_template->post ) )
     526                if ( isset( $bbp_topics_template->post->ID ) )
    527527                        $bbp_topic_id = $bbp_topics_template->post->ID;
    528528
     
    671671                 */
    672672                function bbp_get_topic_forum_id ( $topic_id = '' ) {
     673                        global $bbp_topics_template;
     674
    673675                        if ( !$topic_id )
    674676                                $topic_id = bbp_get_topic_id();
    675677
    676678                        $forum_id = get_post_field( 'post_parent', $bbp_topics_template );
     679
    677680                        return apply_filters( 'bbp_get_topic_forum_id', $forum_id );
    678681                }
     
    750753                        $topic_id = bbp_get_topic_id();
    751754
    752                 $topic_replies = get_pages( array( 'post_parent' => $topic_id, 'post_type' => BBP_REPLY_POST_TYPE_ID ) );
    753 
    754                 return apply_filters( 'bbp_get_topic_reply_count', count( $topic_replies, COUNT_RECURSIVE ) );
     755                $topic_replies = 0; //get_pages( array( 'post_parent' => $topic_id, 'post_type' => BBP_REPLY_POST_TYPE_ID ) );
     756
     757                return apply_filters( 'bbp_get_topic_reply_count', $topic_replies );
    755758
    756759                //return apply_filters( 'bbp_get_topic_topic_reply_count', (int)get_post_meta( $topic_id, 'bbp_topic_topic_reply_count', true ) );
     
    931934
    932935        // Return object
    933         return apply_filters( 'bbp_has_replies', $bbp_replies_template->have_posts(), &$bbp_replies_template );
     936        return apply_filters( 'bbp_has_replies', $bbp_replies_template->have_posts(), $bbp_replies_template );
    934937}
    935938
     
    9981001
    9991002                // Currently inside a topic loop
    1000                 if ( isset( $bbp_replies_template->post ) )
     1003                if ( isset( $bbp_replies_template->post->ID ) )
    10011004                        $bbp_reply_id = $bbp_replies_template->post->ID;
    10021005
     
    12111214        global $wp_query;
    12121215
    1213         if ( BBP_FORUM_POST_TYPE_ID === $wp_query->query_vars['post_type'] )
     1216        if ( isset( $wp_query->query_vars['post_type'] ) && BBP_FORUM_POST_TYPE_ID === $wp_query->query_vars['post_type'] )
     1217                return true;
     1218
     1219        if ( isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) && BBP_FORUM_POST_TYPE_ID === $_GET['post_type'] )
    12141220                return true;
    12151221
     
    12301236        global $wp_query;
    12311237
    1232         if ( BBP_TOPIC_POST_TYPE_ID === $wp_query->query_vars['post_type'] )
     1238        if ( isset( $wp_query->query_vars['post_type'] ) && BBP_TOPIC_POST_TYPE_ID === $wp_query->query_vars['post_type'] )
     1239                return true;
     1240
     1241        if ( isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) && BBP_TOPIC_POST_TYPE_ID === $_GET['post_type'] )
    12331242                return true;
    12341243
     
    12491258        global $wp_query;
    12501259
    1251         if ( BBP_REPLY_POST_TYPE_ID === $wp_query->query_vars['post_type'] )
     1260        if ( isset( $wp_query->query_vars['post_type'] ) && BBP_REPLY_POST_TYPE_ID === $wp_query->query_vars['post_type'] )
    12521261                return true;
    12531262
     1263        if ( isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) && BBP_REPLY_POST_TYPE_ID === $_GET['post_type'] )
     1264                return true;
     1265
    12541266        return false;
    12551267}
Note: See TracChangeset for help on using the changeset viewer.