·
Added a discussion

Hello.

is there a way to log all users off or log a user off automatically after a certain time of inactivity?

Thank you in advance

finn

https://educatedsingles.com/

  • 657
Comments
    • Hello @EducatedSingles !

      Well, the logout clears the COOKIE and Sessions of the logged user, but it's not possible to do with the default code.

      So you need to create the class which will be a child of BxDolService class, redeclare there the destroy method to provide the possibility to work with predicated ID and write the Cron script which will call your class in some interval. See the code the mentioned method:

      function destroy($bDeleteCookies = true)

          {

              if ($bDeleteCookies) {

                  $aUrl = parse_url(BX_DOL_URL_ROOT);

                  $sPath = isset($aUrl['path']) && !empty($aUrl['path']) ? $aUrl['path'] : '/';

                  setcookie(BX_DOL_SESSION_COOKIE, '', time() - 86400, $sPath, '', false, true);

                  unset($_COOKIE[BX_DOL_SESSION_COOKIE]);

              }

              $this->oDb->delete($this->sId);

              $this->sId = '';

              $this->iUserId = 0;

              $this->aData = array();

          }

      You need to add there the work with provided ID, not only from the COOKIE.

      • Thank you very much! Will try it out

        Login or Join to comment.