• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Force logout on page close

boyjah

Member
Is there a way to logout a user when they close a specific page that contains a Fabrik form?

We have a terms of service form that the logged in user must click the I Agree radio button and then submit. But if they close the page without doing that, we want to automatically log them out.
 
Should the users be logged out when they:

1. Press Cancel button on Fabrik form?
2. Just leave the form open without submitting?
3. When they close browser / browser tab or navigate to another url?
4. All of the above?
 
OK, haven't tested this approach, but it might work. You should be able to do this on beforeunload event which triggers when you navigate away from the form or close the browser window/tab.

First add this e.g. to your form templates default.php file:
Code:
<script>
jQuery(window).on('beforeunload', function(e) {
  //make your ajax call here
  return true;
 });
</script>

and in place of your ajax call you can call a php-script were you destroy the users session like:
Code:
$session = JFactory::getSession();
$session->destroy();

There might be other easier solutions, but I cannot think of any right now.

Of course the easy one would be to set the session lifetime to a very short time like a couple of minutes, but that's probably not what you want.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top