Hi all,
I'd like to hide a module from users that have been on the "Registration Complete"-Page, but are not yet logged in.
Can this be achieved with a cookie ?
Thanx for info
phreak
Make Cookie while Registration
Moderators: tjay, seadap, Rogue4ngel, matthewhayashida
Forum rules
Re: Make Cookie while Registration
Hi,
in 1.5 test for $user->guest - if it's true, the user did not yet login.
$user = &JFactory::getUser();
in 1.0 check the global $my variable.
CirTap
in 1.5 test for $user->guest - if it's true, the user did not yet login.
$user = &JFactory::getUser();
in 1.0 check the global $my variable.
CirTap
You can have programs written fast, well, and cheap, but you only get to pick 2 ...
"I love deadlines. I like the whooshing sound they make as they fly by." Douglas Adams
"I love deadlines. I like the whooshing sound they make as they fly by." Douglas Adams
Re: Make Cookie while Registration
J 1.0.13
I'm writing the cookie in registration.hmtl.php:
and like to call it in the index.php of the template and hide :
Thanx for help
phreak
I'm writing the cookie in registration.hmtl.php:
Code: Select all
<?php
if(!isset($_COOKIE['mein_cookie'])){
setcookie('mein_cookie','mein_wert',time()+3600,'/');}
?>
and like to call it in the index.php of the template and hide :
Code: Select all
<?php
if(isset($_COOKIE['mein_cookie'])) {
- - - - - What needs to go here to kill <?php mosLoadModules ( 'left' ); ?> - - - - - }
?>
Thanx for help
phreak
Re: Make Cookie while Registration
Hallo,
you already wrote the code but just need to put the pieces together in the right way:
[php]
if ( isset($_COOKIE['mein_cookie']) ) {
mosLoadModules( 'left' );
}
?>[/php]
or if you need additional markup in between
[php]
[/php]
that's all a bit hackish and you should consider writing a system plugin rather to test for the frontpage (system plugins *also* rn in admin!), the presence of the registration page and the user login status to manage the cookie stuff.
The $user object (still) provides more valuable information, i.e. if the user has regitered, but not activated, last access time etc.
[php]
$user = $mainframe->getUser();
$user->params
$user->name
$user->email
$user->block
$user->sendEmail
$user->registerDate // <--
$user->lastvisitDate // <--
$user->activation // <--
[/php]
Have fun,
CirTap
you already wrote the code but just need to put the pieces together in the right way:
[php]
if ( isset($_COOKIE['mein_cookie']) ) {
mosLoadModules( 'left' );
}
?>[/php]
or if you need additional markup in between
[php]
[/php]
that's all a bit hackish and you should consider writing a system plugin rather to test for the frontpage (system plugins *also* rn in admin!), the presence of the registration page and the user login status to manage the cookie stuff.
The $user object (still) provides more valuable information, i.e. if the user has regitered, but not activated, last access time etc.
[php]
$user = $mainframe->getUser();
$user->params
$user->name
$user->email
$user->block
$user->sendEmail
$user->registerDate // <--
$user->lastvisitDate // <--
$user->activation // <--
[/php]
Have fun,
CirTap
You can have programs written fast, well, and cheap, but you only get to pick 2 ...
"I love deadlines. I like the whooshing sound they make as they fly by." Douglas Adams
"I love deadlines. I like the whooshing sound they make as they fly by." Douglas Adams