Skip to:
Content

BuddyPress.org

Changeset 1503 for trunk/bp-groups.php


Ignore:
Timestamp:
06/03/2009 10:49:34 PM (17 years ago)
Author:
apeatling
Message:

Removed the use of sessions in BuddyPress, as this is not a robust solution when installed on a multi-server setup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-groups.php

    r1477 r1503  
    362362                $completed_to_step = 0;
    363363               
    364                 unset($_SESSION['group_obj_id']);
    365                 unset($_SESSION['completed_to_step']);
     364                setcookie( 'bp_group_obj_id', false, time() - 1000, COOKIEPATH );
     365                setcookie( 'bp_group_completed_to_step', false, time() - 1000, COOKIEPATH );
    366366               
    367367                $no_instantiate = true;
    … …  
    369369        }
    370370       
    371         if ( isset($_SESSION['completed_to_step']) && !$reset_steps ) {
    372                 $completed_to_step = $_SESSION['completed_to_step'];
     371        if ( isset($_COOKIE['bp_group_completed_to_step']) && !$reset_steps ) {
     372                $completed_to_step = $_COOKIE['bp_group_completed_to_step'];
    373373        }
    374374       
    375375        if ( isset( $_POST['save'] ) || isset( $_POST['skip'] ) ) {
    376                 $group_obj = new BP_Groups_Group( $_SESSION['group_obj_id'] );
    377 
    378                 if ( !$group_id = groups_create_group( $create_group_step, $_SESSION['group_obj_id'] ) ) {
     376                $group_obj = new BP_Groups_Group( $_COOKIE['bp_group_obj_id'] );
     377
     378                if ( !$group_id = groups_create_group( $create_group_step, $_COOKIE['bp_group_obj_id'] ) ) {
    379379                        bp_core_add_message( __('There was an error saving group details. Please try again.', 'buddypress'), 'error' );
    380380                        bp_core_redirect( $bp->loggedin_user->domain . $bp->groups->slug . '/create/step/' . $create_group_step );
    … …  
    382382                        $create_group_step++;
    383383                        $completed_to_step++;
    384                         $_SESSION['completed_to_step'] = $completed_to_step;
    385                         $_SESSION['group_obj_id'] = $group_id;
     384                       
     385                        /* Unset cookie info */
     386                        setcookie( 'bp_group_obj_id', false, time() - 1000, COOKIEPATH );
     387                        setcookie( 'bp_group_completed_to_step', false, time() - 1000, COOKIEPATH );
     388                       
     389                        /* Reset cookie info */
     390                        setcookie( 'bp_group_obj_id', $group_id, time()+60*60*24, COOKIEPATH );
     391                        setcookie( 'bp_group_completed_to_step', $completed_to_step, time()+60*60*24, COOKIEPATH );
    386392                }
    387393               
    … …  
    390396        }
    391397
    392         if ( isset($_SESSION['group_obj_id']) && !$group_obj && !$no_instantiate )
    393                 $group_obj = new BP_Groups_Group( $_SESSION['group_obj_id'] );
     398        if ( isset($_COOKIE['bp_group_obj_id']) && !$group_obj && !$no_instantiate )
     399                $group_obj = new BP_Groups_Group( $_COOKIE['bp_group_obj_id'] );
    394400       
    395401        bp_core_load_template( apply_filters( 'groups_template_create_group', 'groups/create' ) );
Note: See TracChangeset for help on using the changeset viewer.