applications/vanilla/modules/class.categoryfollowtogglemodule.php
public function SetToggle() {
      $Session = Gdn::Session();
      if (!$Session->IsValid())
         return;
      
      $ShowAllCategories = GetIncomingValue('ShowAllCategories', '');
      if ($ShowAllCategories != '') {
         $ShowAllCategories = $ShowAllCategories == 'true' ? TRUE : FALSE;
         $ShowAllCategoriesPref = $Session->GetPreference('ShowAllCategories');
         if ($ShowAllCategories != $ShowAllCategoriesPref)
            $Session->SetPreference('ShowAllCategories', $ShowAllCategories);
            
         Redirect('/'.ltrim(Gdn::Request()->Path(), '/'));
      }
   }
public function SetToggle() {
      $Session = Gdn::Session();
      if (!$Session->IsValid())
         return;
      
      $ShowAllCategories = GetIncomingValue('ShowAllCategories', '');
      if ($ShowAllCategories != '') {
         $ShowAllCategories = $ShowAllCategories == 'true' ? TRUE : FALSE;
         $ShowAllCategoriesPref = $Session->GetPreference('ShowAllCategories');
         if ($ShowAllCategories != $ShowAllCategoriesPref)
            $Session->SetPreference('ShowAllCategories', $ShowAllCategories);
            
         Redirect('/'.ltrim(Gdn::Request()->Path(), '/'));
      }
   }
public function SetToggle ( ) { $ Session = Gdn :: Session ( ) ; if ( ! $ Session -> IsValid ( ) ) return ; $ ShowAllCategories = GetIncomingValue ( 'ShowAllCategories' , '' ) ; if ( $ ShowAllCategories != '' ) { $ ShowAllCategories = $ ShowAllCategories == 'true' ? TRUE : FALSE ; $ ShowAllCategoriesPref = $ Session -> GetPreference ( 'ShowAllCategories' ) ; if ( $ ShowAllCategories != $ ShowAllCategoriesPref ) $ Session -> SetPreference ( 'ShowAllCategories' , $ ShowAllCategories ) ; Redirect ( '/' . ltrim ( Gdn :: Request ( ) -> Path ( ) , '/' ) ) ; } }
Set the preference in the user's session.
Set the preference in the user s session .