2

I have a module (RSForm Pro) which shows on my site on page load.

I want all new site visitors to be shown this module, but I don't want it shown if details have been added to the form or the form has been closed (using the [x]).

What's the best way to do this? Can this be done using a cookie?

You can see the module in action here: http://trade.inapub.co.uk/

0

2 Answers 2

2

I would personally stay away from cookies in this instance, as they can be deleted from the browser.

Instead, you would be better off (If the user must be logged in first):

  1. Creating a database table with a column called user_id
  2. Write a database query that gets executed once the form has been filled in and add the user ID to the user_id column in the database.
  3. Once a user visits your site, run a database query to check if the user's ID exists in your database table.
  4. Get the results from the query and show your form if their ID doesn't exist

If you user doesn't need to be logged in (form is for public use), then I would suggest using a PHP session and of course sticking to Joomla's coding standards when doing so.

1
  • Thanks for the answer, I've updated the question with additional details. Any further ideas please? Jan 8, 2015 at 8:55
2

You could try using a plugin called Simple Pop-Up. It's a plugin that will display anything between {simplepopup} tags in a modal popup. The tags can be added to articles, modules or basically any part where the content can be processed by plugins. The plugin can be configured to load only once for each user.

I haven't tested this, but if your form is loaded in a module, you could try this:

{simplepopup}{loadposition YouFormPosition}{/simplepopup}

Another option could be to use MetaMod (commercial extension). According to their tutorials, you can do something like this:

$c = JRequest::getInt('SeenIt', 0, 'cookie');
if ($c) return; /* if cookie was set, don't show anything, else... */
setcookie( 'SeenIt', 1, time()+60*60*24*365*10, '/' );
return 101; /* return module 101, but only the first time */ 
1
  • Thanks for the answer, I've updated the question with additional details. Any further ideas please? Jan 8, 2015 at 8:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.