Posted by Screenack on April 29, 2011 at 10:45am
I have a simple event I need to track.
User comes to a site's home page. To enter the site, the user must click a "terms acceptance" link on an enter page. If the user doesn't want to accept the terms, the site redirects the user back to the home page.
The flow is:
home page -> terms acceptance -> yes -> go to rest of site
home page -> terms acceptance -> no (or no action taken) -> back to home page
home page -> if user tries to access any other page, but terms not accepted -> redirect to terms acceptance page
Any recommendations on implementing this? I'd prefer to do this in D7 but I'm willing to do so in D6, too.
Thanks!

Comments
Ironic
It's funny how writing the question carefully reframes the idea. I found this module that may do the trick: http://drupal.org/project/terms_of_use
Kyle
Back to the drawing board
Sadly, Terms of Use won't cut it for my needs. I only need to "ToU" a few pages, not the entire site and this adds text for user registration.
I simply need to track whether, by clicking on a link, that the user has "agreed" to the terms on that page before allowing access to a few pages.
This would be something like:
User tries to access a section page (either by link or bookmark)
The target page would then process:
Session variable check whether variable "agreed" is set (or true)
If no, redirect to the agreement page (with link)
If set, allow user to view page
As always, thanks in advance!
Did you find the solution, Kyle?
I need to do exactly the same thing in my website, did you find the solution? Could you help me?
Thanks in advance!
What I did
I'm using webform PHP Filter core module and sessions.
Here is roughly the process:
for the webform/show first block:
<?php$url = request_uri();
if ( (! isset($_SESSION['form_filed'])) && $url == "/thepage/youwant") {
$_SESSION['form_filed']=1;
return true;
}
?>
On the block you ultimately want to show:
<?php$url = request_uri();
if (isset($_SESSION['form_filed']) && $url == "/thepage/youwant") {
return true;
}
?>
<?php header("location:/thepage/youwant");?>Notes: originally webform for D6 supported php filters on submissions, which is what I originally wanted BUT they took out as they see it as too high a security vulnerability. I suspect moving the php code into template.php would be better, or its own module.
So, I know; it's a lazy system. Merely refreshing the page will "let you in." But this is by design. It isn't meant to be Fort Knox, rather, if we get info, great. If not, we give out some marketing material anyhow.
By the way, I put this up there so the Drupal Illuminati can flay it seven ways to Sunday. I love learning better ways to doing things.
Thanks
Thank you, Kyle, you've been so kind to me. I'll try it tomorrow and I'll let you know.
Hi Kyle, I tried your method
Hi Kyle,
I tried your method but I did not get to anywhere..maybe my poor english misunderstood something.
Anyway, thanks! If I find another solution, I'll post it here.
What happened?
If you want to step through it, I'd be happy to help you through it. If it's not a good fit; that's cool, too.
What happened?
If you want to step through it, I'd be happy to help you through it. If it's not a good fit; that's cool, too.
What I did
Hi Kyle,
Thanks for your help.
I've finally used a popup to resolve the problem. You need to install Lightbox module.
In front page I put:
In the header:
$(document).ready(function () {
$('#lightboxAutoModal').triggerHandler("click");
$("#skip").click(function() {
Lightbox.end('forceClose');
});
});
In the body:
<?phpglobal $user;
?>
<?phpif (!isset($_COOKIE["welcomead"]) and !$user->uid) {
?>
LEGAL TEXT
Agree
<?php
//set a cookie "welcomead" 1 hour
setcookie("welcomead","Ad Viewed", time()+3600, '/','example.com');
}
?>
In the page.tpl: (cookie and user control):
<?phpglobal $user;
?>
<?phpif (!isset($_COOKIE["welcomead"]) and !$user->uid) {
drupal_goto('<front>');
}
?>
I hope this can help other people.