Skip to:
Content

BuddyPress.org

Changeset 3473


Ignore:
Timestamp:
11/21/2010 11:43:15 PM (16 years ago)
Author:
boonebgorges
Message:

WP_DEBUG fixes on group forum pages

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-templatetags.php

    r3472 r3473  
    17821782    global $bp;
    17831783
    1784     if ( BP_GROUPS_SLUG == $bp->current_component && $bp->is_single_item && 'forum' == $bp->current_action && 'topic' == $bp->action_variables[0] )
     1784    if ( BP_GROUPS_SLUG == $bp->current_component && $bp->is_single_item && 'forum' == $bp->current_action && isset( $bp->action_variables[0] ) && 'topic' == $bp->action_variables[0] )
    17851785        return true;
    17861786
     
    17911791    global $bp;
    17921792
    1793     if ( BP_GROUPS_SLUG == $bp->current_component && $bp->is_single_item && 'forum' == $bp->current_action && 'topic' == $bp->action_variables[0] && 'edit' == $bp->action_variables[2] )
     1793    if ( BP_GROUPS_SLUG == $bp->current_component && $bp->is_single_item && 'forum' == $bp->current_action && isset( $bp->action_variables[0] ) && 'topic' == $bp->action_variables[0] && isset( $bp->action_variables[2] ) && 'edit' == $bp->action_variables[2] )
    17941794        return true;
    17951795
  • trunk/bp-forums.php

    r3455 r3473  
    515515        for ( $i = 0; $i < count( $posts ); $i++ ) {
    516516            foreach ( (array)$poster_names as $name ) {
    517                 if ( $name->user_id == $topics[$i]->user_id )
     517                if ( isset( $topics[$i] ) && $name->user_id == $topics[$i]->user_id )
    518518                $posts[$i]->poster_name = $poster->value;
    519519            }
  • trunk/bp-forums/bp-forums-templatetags.php

    r3369 r3473  
    8484
    8585        if ( !$no_stickies ) {
     86            $stickies = array();
     87            $standard = array();
     88
    8689            // Place stickies at the top - not sure why bbPress doesn't do this?
    8790            foreach( (array)$this->topics as $topic ) {
     
    188191
    189192    /* If $_GET['fs'] is set, let's auto populate the search_terms var */
    190     if ( $bp->is_directory && !empty( $_GET['fs'] ) )
     193    if ( isset( $bp->is_directory ) && !empty( $_GET['fs'] ) )
    191194        $search_terms = $_GET['fs'];
    192195
  • trunk/bp-groups.php

    r3472 r3473  
    288288
    289289        /* Fetch the details we need */
    290         $topic_slug = $bp->action_variables[1];
     290        $topic_slug = isset( $bp->action_variables[1] ) ? $bp->action_variables[1] : false;
    291291        $topic_id = bp_forums_get_topic_id_from_slug( $topic_slug );
    292292        $forum_id = groups_get_groupmeta( $bp->groups->current_group->id, 'forum_id' );
     
    295295
    296296            /* Posting a reply */
    297             if ( !$bp->action_variables[2] && isset( $_POST['submit_reply'] ) ) {
     297            if ( !isset( $bp->action_variables[2] ) && isset( $_POST['submit_reply'] ) ) {
    298298                /* Check the nonce */
    299299                check_admin_referer( 'bp_forums_new_reply' );
     
    303303                    groups_join_group( $bp->groups->current_group->id, $bp->loggedin_user->id );
    304304
    305                 if ( !$post_id = groups_new_group_forum_post( $_POST['reply_text'], $topic_id, $_GET['topic_page'] ) )
     305                                $topic_page = isset( $_GET['topic_page'] ) ? $_GET['topic_page'] : false;
     306
     307                if ( !$post_id = groups_new_group_forum_post( $_POST['reply_text'], $topic_id, $topic_page ) )
    306308                    bp_core_add_message( __( 'There was an error when replying to that topic', 'buddypress'), 'error' );
    307309                else
    308310                    bp_core_add_message( __( 'Your reply was posted successfully', 'buddypress') );
    309311
    310                 if ( $_SERVER['QUERY_STRING'] )
     312                if ( isset( $_SERVER['QUERY_STRING'] ) )
    311313                    $query_vars = '?' . $_SERVER['QUERY_STRING'];
    312314
     
    315317
    316318            /* Sticky a topic */
    317             else if ( 'stick' == $bp->action_variables[2] && ( $bp->is_item_admin || $bp->is_item_mod ) ) {
     319            else if ( isset( $bp->action_variables[2] ) && 'stick' == $bp->action_variables[2] && ( isset( $bp->is_item_admin ) || isset( $bp->is_item_mod ) ) ) {
    318320                /* Check the nonce */
    319321                check_admin_referer( 'bp_forums_stick_topic' );
     
    329331
    330332            /* Un-Sticky a topic */
    331             else if ( 'unstick' == $bp->action_variables[2] && ( $bp->is_item_admin || $bp->is_item_mod ) ) {
     333            else if ( isset( $bp->action_variables[2] ) && 'unstick' == $bp->action_variables[2] && ( isset( $bp->is_item_admin ) || isset( $bp->is_item_mod ) ) ) {
    332334                /* Check the nonce */
    333335                check_admin_referer( 'bp_forums_unstick_topic' );
     
    343345
    344346            /* Close a topic */
    345             else if ( 'close' == $bp->action_variables[2] && ( $bp->is_item_admin || $bp->is_item_mod ) ) {
     347            else if ( isset( $bp->action_variables[2] ) && 'close' == $bp->action_variables[2] && ( isset( $bp->is_item_admin ) || isset( $bp->is_item_mod ) ) ) {
    346348                /* Check the nonce */
    347349                check_admin_referer( 'bp_forums_close_topic' );
     
    357359
    358360            /* Open a topic */
    359             else if ( 'open' == $bp->action_variables[2] && ( $bp->is_item_admin || $bp->is_item_mod ) ) {
     361            else if ( isset( $bp->action_variables[2] ) && 'open' == $bp->action_variables[2] && ( isset( $bp->is_item_admin ) || isset( $bp->is_item_mod ) ) ) {
    360362                /* Check the nonce */
    361363                check_admin_referer( 'bp_forums_open_topic' );
     
    371373
    372374            /* Delete a topic */
    373             else if ( 'delete' == $bp->action_variables[2] && empty( $bp->action_variables[3] ) ) {
     375            else if ( isset( $bp->action_variables[2] ) && 'delete' == $bp->action_variables[2] && empty( $bp->action_variables[3] ) ) {
    374376                /* Fetch the topic */
    375377                $topic = bp_forums_get_topic_details( $topic_id );
     
    392394
    393395            /* Editing a topic */
    394             else if ( 'edit' == $bp->action_variables[2] && empty( $bp->action_variables[3] ) ) {
     396            else if ( isset( $bp->action_variables[2] ) && 'edit' == $bp->action_variables[2] && empty( $bp->action_variables[3] ) ) {
    395397                /* Fetch the topic */
    396398                $topic = bp_forums_get_topic_details( $topic_id );
     
    417419
    418420            /* Delete a post */
    419             else if ( 'delete' == $bp->action_variables[2] && $post_id = $bp->action_variables[4] ) {
     421            else if ( isset( $bp->action_variables[2] ) && 'delete' == $bp->action_variables[2] && isset( $bp->action_variables[4] ) && $post_id = $bp->action_variables[4] ) {
    420422                /* Fetch the post */
    421423                $post = bp_forums_get_post( $post_id );
     
    438440
    439441            /* Editing a post */
    440             else if ( 'edit' == $bp->action_variables[2] && $post_id = $bp->action_variables[4] ) {
     442            else if ( isset( $bp->action_variables[2] ) && 'edit' == $bp->action_variables[2] && isset( $bp->action_variables[4] ) && $post_id = $bp->action_variables[4] ) {
    441443                /* Fetch the post */
    442444                $post = bp_forums_get_post( $bp->action_variables[4] );
     
    486488                    $error_message = __( 'Forum posts cannot be empty. Please enter some text.', 'buddypress' );
    487489               
    488                 if ( $error_message ) {
     490                if ( isset( $error_message ) ) {
    489491                    bp_core_add_message( $error_message, 'error' );
    490492                    $redirect = bp_get_group_permalink( $bp->groups->current_group ) . 'forum';
     
    514516
    515517    if ( $bp->is_single_item ) {
    516         /* Refresh the group member count meta */
     518        // Refresh the group member count meta
    517519        groups_update_groupmeta( $bp->groups->current_group->id, 'total_member_count', groups_get_total_member_count( $bp->groups->current_group->id ) );
    518520
Note: See TracChangeset for help on using the changeset viewer.