Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

November 29, 2022, 05:30:24 AM

Login with username, password and session length
Members
  • Total Members: 3853
  • Latest: tty456
Stats
  • Total Posts: 193623
  • Total Topics: 21107
  • Online today: 71
  • Online ever: 3540
  • (September 02, 2022, 06:38:54 PM)
Users Online
Users: 1
Guests: 39
Total: 40

Author Topic: greet visitor by time of day  (Read 6915 times)

0 Members and 1 Guest are viewing this topic.

troll

  • Guest
Re: greet visitor by time of day
« Reply #10 on: April 12, 2008, 12:51:33 PM »
Thanks again, now is there a  way to change the forum default time? I just read on SMF that its based on the server time is that right?

JPDeni

  • Guest
Re: greet visitor by time of day
« Reply #11 on: April 12, 2008, 12:57:38 PM »
It is based on server time, but you can alter it in the admin section.

Add this line to the start of the code:

Code: [Select]
global $user_info, $modSettings;

And change

Code: [Select]
$hour = date('G');

to
Code: [Select]
$time = time() + ($user_info['time_offset'] + $modSettings['time_offset']) * 3600;
$hour = date('G',$time);

This will take into account any adjustments you have made to the time, as well as adjustments that an individual has made through his/her profile.

troll

  • Guest
Re: greet visitor by time of day
« Reply #12 on: April 12, 2008, 01:00:07 PM »
You are a clever cookie! I dont think I better mess about with all the settings though just to have a few members see it change <<-- *rolls eyes*

They can wait until it changes!!!

JPDeni

  • Guest
Re: greet visitor by time of day
« Reply #13 on: April 12, 2008, 01:12:30 PM »
Well, I wrote a whole long thing that has a different greeting for every hour of the day and also greets people on holidays, birthdays and their anniversary of joining the site. Also a special greeting for someone's first day on the site. It can also have images.

http://www.tinyportal.net/index.php?topic=9940.0

This code is much simpler, though. I went a little loony with my code.  :o

evulness

  • Guest
Re: greet visitor by time of day
« Reply #14 on: April 14, 2008, 11:46:07 AM »
wow i'm glad others found this useful lol

i'm surprised no one else has posted something similar.

i liked your custom one you post, but didn't want the pictures.



JPDeni

  • Guest