Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

NEED HELP PLEASE!

NEED HELP PLEASE!

Hi

I have been searching for something that allows this:

All 300 of my users on my 1.7 site have to go to a particular page, Page A, then they get directed to another page. I need them to once landed on page A, not to allow them to go it it again, therefore the limit == 1.

PLEASE PLEASE can someone tell me which of these compnents to use as well as a little bit of help with what code to write to allow EACH user to only view the page ONCE

Thank you for the great extension!!! Hopefully I will have an answer by tommorrows deadline!!!!

dev02
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Re: NEED HELP PLEASE!

[moved to MetaMod forum]

You can do this very easily with Chameleon, but with a few lines of code you can do this with (free) MetaMod as well.

With Chameleon:

1 - create a new rule that "detects session variable A" in the conditions (use the dropdown), AND detects the exact page 'A'. This might be via the URL selector, or the menu item selector, or via the article selector that can detect a certain article by id number... whatever works best for you.

2 - In the "SUCCEED action", use the redirect dropdown to redirect to page 'B'.

3 - create a second rule that detects the exact page 'A' using the same selectors in the 1st rule, except don't do the "detect session variable A" thing.

4 - in the SUCCEED action in the 2nd rule, use the dropdown to "Set session variable A".


Ok, so here's how it works: the each time a user views a page, rule 1 gets triggered. It checks to see if the user is on page 'A', AND that session variable A. So if the user is not on that page, or is on that page for the 1st time, it won't redirect, but goes on to the next rule.

Rule 2 checks to see if the user is visiting page 'A'. If s/he is, then the session variable gets set.

Now that the session variable is set, the next time the user goes back to page 'A', it will trigger the redirect.


How to do this with MetaMod:

1 - make a new MetaMod module and assign it to an inconspicuous position e.g. in the footer or someplace like that. It won't have any output, but can sometimes still affect the layout.

2 - in the PHP code of the MetaMod, use the following. This recipe detects the page via URL, but you can change that if you like.

Code:

// adjust the URL here:

$on_page_a = $core_genius->check("url = http://www.mysite.com/page_a.html");
if (isset($SESSION['page_seen']) and $on_page_a) {
  $app = &JFactory::getApplication();
  $app->redirect("http://www.mysite.com/page_b.html");
}
if ($on_page_a) {
  $SESSION['page_seen'] = true;
}

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3329 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1696
Total Polls:
6
Total Posts:
5941
Posts this week:
7
User Info:
 
Total Users:
5418
Newest User:
outsd2
Members Online:
0
Guests Online:
128

Online: 
There are no members online

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked