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.

 

time online (sessions)

time online (sessions)

Has anyone been able to display a module based on how long a given viewer (not registered or logged in) has been on a site?

Perhaps using sessions  information?

I have a few modules that i would like up for the first few moments when a person come to the site but after awhile i would like for them to be gone and out of he way for a much cleaner site. And i don't want members to have to see them at all if they are logged in.

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

Re: time online (sessions)

There's an example of showing a module once per session in this recipe page: http://www.metamodpro.com/support/recip … er-session

You can easily modify this to only show the modules to non-logged-in users. In fact, you should just be able to use the "Show Quick module(s) to" selector to restrict the access to only people who are not logged in. (despite the label, it affects the PHP rules as well as the Quick Module ID Include).

Does "once per session" cover your needs, or do you really want to show the module, for example, "on every page for the first 5 minutes someone is on the site" ? That's certainly achievable, just takes a little longer to code.

Hope that helps,
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
3328 Posts
User info in posts
Administrator has disabled public posting

Re: time online (sessions)

Does "once per session" cover your needs, or do you really want to show the module, for example, "on every page for the first 5 minutes someone is on the site" ? That's certainly achievable, just takes a little longer to code.


If he dont need it i surely do. Can someone help?

lil2art
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: time online (sessions)

Ok, here's how to make the modules only appear for the 1st 10 minutes of any user session. So if they come back in a different session, then the modules will re-appear for the 1st 10 minutes.

if ($MM_LOGGED_IN) return; // short-circuit: return nothing if user is logged in
$session =& JFactory::getSession();
$starttime = (int)$session->get('modulestarttime');
$seconds = 10 * 60; // 10 * 60 = 10 minutes
$moduleid = XXX; // replace XXX with the module id of the module to display
if ( $starttime == 0 ) {
  $session->set( 'modulestarttime', time() );
  return $moduleid; // they just entered the site
}
if ($starttime + $seconds > time() ) {
  return $moduleid;
}

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
3328 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1686
Total Polls:
6
Total Posts:
5933
Total Posts Today:
7
User Info:
 
Total Users:
4432
Newest User:
kinggambling14
Members Online:
0
Guests Online:
167

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