Skip to:
Content

BuddyPress.org

Changeset 3472


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

Fixes a whole bunch of WP_DEBUG problems with groups and especially group creation.

Location:
trunk
Files:
3 edited

Legend:

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

    r3454 r3472  
    705705        function bp_get_avatar_admin_step() {
    706706                global $bp;
    707 
    708                 return apply_filters( 'bp_get_avatar_admin_step', $bp->avatar_admin->step );
     707               
     708                if ( isset( $bp->avatar_admin->step ) )
     709                        $step = $bp->avatar_admin->step;
     710                else
     711                        $step = '';
     712
     713                return apply_filters( 'bp_get_avatar_admin_step', $step );
    709714        }
    710715
    … …  
    714719        function bp_get_avatar_to_crop() {
    715720                global $bp;
    716 
    717                 return apply_filters( 'bp_get_avatar_to_crop', $bp->avatar_admin->image->url );
     721               
     722                if ( isset( $bp->avatar_admin->image->url ) )
     723                        $url = $bp->avatar_admin->image->url;
     724                else
     725                        $url = '';
     726
     727                return apply_filters( 'bp_get_avatar_to_crop', $url );
    718728        }
    719729
    … …  
    10271037                $options['groups'] = __( 'Groups', 'buddypress' );
    10281038
    1029         if ( function_exists( 'bp_forums_is_installed_correctly' ) && bp_forums_is_installed_correctly() && !(int) $bp->site_options['bp-disable-forum-directory'] )
     1039        if ( function_exists( 'bp_forums_is_installed_correctly' ) && bp_forums_is_installed_correctly() && !isset( $bp->site_options['bp-disable-forum-directory'] ) )
    10301040                $options['forums'] = __( 'Forums', 'buddypress' );
    10311041
  • trunk/bp-groups.php

    r3455 r3472  
    9797                        /* When in a single group, the first action is bumped down one because of the
    9898                           group name, so we need to adjust this and set the group name to current_item. */
    99                         $bp->current_item = $bp->current_action;
    100                         $bp->current_action = $bp->action_variables[0];
     99                        $bp->current_item = isset( $bp->current_action ) ? $bp->current_action : false;
     100                        $bp->current_action = isset( $bp->action_variables[0] ) ? $bp->action_variables[0] : false;
    101101                        array_shift($bp->action_variables);
    102102
    … …  
    990990
    991991        /* If no current step is set, reset everything so we can start a fresh group creation */
    992         if ( !$bp->groups->current_create_step = $bp->action_variables[1] ) {
     992        if ( !isset( $bp->action_variables[1] ) || !$bp->groups->current_create_step = $bp->action_variables[1] ) {
    993993
    994994                unset( $bp->groups->current_create_step );
    … …  
    10091009
    10101010        /* Fetch the currently completed steps variable */
    1011         if ( isset( $_COOKIE['bp_completed_create_steps'] ) && !$reset_steps )
     1011        if ( isset( $_COOKIE['bp_completed_create_steps'] ) && !isset( $reset_steps ) )
    10121012                $bp->groups->completed_create_steps = unserialize( stripslashes( $_COOKIE['bp_completed_create_steps'] ) );
    10131013
    … …  
    10291029                                bp_core_redirect( $bp->root_domain . '/' . $bp->groups->slug . '/create/step/' . $bp->groups->current_create_step . '/' );
    10301030                        }
    1031 
    1032                         if ( !$bp->groups->new_group_id = groups_create_group( array( 'group_id' => $bp->groups->new_group_id, 'name' => $_POST['group-name'], 'description' => $_POST['group-desc'], 'slug' => groups_check_slug( sanitize_title( esc_attr( $_POST['group-name'] ) ) ), 'date_created' => bp_core_current_time(), 'status' => 'public' ) ) ) {
     1031                       
     1032                        $new_group_id = isset( $bp->groups->new_group_id ) ? $bp->groups->new_group_id : 0;
     1033
     1034                        if ( !$bp->groups->new_group_id = groups_create_group( array( 'group_id' => $new_group_id, 'name' => $_POST['group-name'], 'description' => $_POST['group-desc'], 'slug' => groups_check_slug( sanitize_title( esc_attr( $_POST['group-name'] ) ) ), 'date_created' => bp_core_current_time(), 'status' => 'public' ) ) ) {
    10331035                                bp_core_add_message( __( 'There was an error saving group details, please try again.', 'buddypress' ), 'error' );
    10341036                                bp_core_redirect( $bp->root_domain . '/' . $bp->groups->slug . '/create/step/' . $bp->groups->current_create_step . '/' );
    … …  
    10751077                 * holding the information
    10761078                 */
    1077                 if ( !in_array( $bp->groups->current_create_step, (array)$bp->groups->completed_create_steps ) )
     1079                $completed_create_steps = isset( $bp->groups->completed_create_steps ) ? $bp->groups->completed_create_steps : array();
     1080                if ( !in_array( $bp->groups->current_create_step, $completed_create_steps ) )
    10781081                        $bp->groups->completed_create_steps[] = $bp->groups->current_create_step;
    10791082
    … …  
    11081111                                }
    11091112
    1110                                 if ( $next ) {
     1113                                if ( isset( $next ) ) {
    11111114                                        $next_step = $key;
    11121115                                        break;
    … …  
    14651468         */
    14661469
    1467         if ( $group_id )
     1470        if ( isset( $group_id ) && $group_id )
    14681471                $group = new BP_Groups_Group( $group_id );
    14691472        else
    14701473                $group = new BP_Groups_Group;
    14711474
    1472         if ( $creator_id )
     1475        if ( isset( $creator_id ) && $creator_id )
    14731476                $group->creator_id = $creator_id;
    14741477        else
  • trunk/bp-groups/bp-groups-templatetags.php

    r3449 r3472  
    11301130
    11311131                // If they're not logged in or are banned from the group, no join button.
    1132                 if ( !is_user_logged_in() || $group->is_banned )
     1132                if ( !is_user_logged_in() || isset( $group->is_banned ) )
    11331133                        return false;
    11341134
    … …  
    16331633        global $bp;
    16341634
    1635         if ( !$bp->groups->completed_create_steps )
     1635        if ( !isset( $bp->groups->completed_create_steps ) )
    16361636                return false;
    16371637
    … …  
    16781678        function bp_get_new_group_id() {
    16791679                global $bp;
    1680                 return apply_filters( 'bp_get_new_group_id', $bp->groups->new_group_id );
     1680               
     1681                if ( isset( $bp->groups->new_group_id ) )
     1682                        $new_group_id = $bp->groups->new_group_id;
     1683                else
     1684                        $new_group_id = 0;
     1685               
     1686                return apply_filters( 'bp_get_new_group_id', $new_group_id );
    16811687        }
    16821688
    … …  
    16861692        function bp_get_new_group_name() {
    16871693                global $bp;
    1688                 return apply_filters( 'bp_get_new_group_name', $bp->groups->current_group->name );
     1694               
     1695                if ( isset( $bp->groups->current_group->name ) )
     1696                        $name = $bp->groups->current_group->name;
     1697                else
     1698                        $name = '';
     1699               
     1700                return apply_filters( 'bp_get_new_group_name', $name );
    16891701        }
    16901702
    … …  
    16941706        function bp_get_new_group_description() {
    16951707                global $bp;
    1696                 return apply_filters( 'bp_get_new_group_description', $bp->groups->current_group->description );
     1708               
     1709                if ( isset( $bp->groups->current_group->description ) )
     1710                        $description = $bp->groups->current_group->description;
     1711                else
     1712                        $description = '';
     1713                       
     1714                return apply_filters( 'bp_get_new_group_description', $description );
    16971715        }
    16981716
Note: See TracChangeset for help on using the changeset viewer.