mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 09:05:55 +00:00
Merge pull request #126 from mateusz/session-fix
Do not change the session-stored subsite, if session is not enabled.
This commit is contained in:
commit
e6f054f55b
@ -123,6 +123,10 @@ class Subsite extends DataObject implements PermissionProvider {
|
|||||||
* @param int|Subsite $subsite Either the ID of the subsite, or the subsite object itself
|
* @param int|Subsite $subsite Either the ID of the subsite, or the subsite object itself
|
||||||
*/
|
*/
|
||||||
public static function changeSubsite($subsite) {
|
public static function changeSubsite($subsite) {
|
||||||
|
// Session subsite change only meaningful if the session is active.
|
||||||
|
// Otherwise we risk setting it to wrong value, e.g. if we rely on currentSubsiteID.
|
||||||
|
if (!Subsite::$use_session_subsiteid) return;
|
||||||
|
|
||||||
if(is_object($subsite)) $subsiteID = $subsite->ID;
|
if(is_object($subsite)) $subsiteID = $subsite->ID;
|
||||||
else $subsiteID = $subsite;
|
else $subsiteID = $subsite;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user