MyBB Community Forums

Full Version: Display day type
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How would I make it display what time of day it is? So like in the morning it'll display Good Morning, ect Confused
You'd need a plugin. I suggest requesting one here: http://community.mybb.com/forum-65.html
No need for a plugin, if you don't mind some javascript that would work. You'd just need to add it to your header.
What kind of Javascript? I only know very basic.
Go to: ACP > Templates > Header Templates > header_welcomeblock_member > and find;
{$lang->welcome_back}

and before it, add the following;
<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Robert Ison -->
<!-- Web Site:  http://www.infosourcetraining.com -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
datetoday = new Date();
timenow=datetoday.getTime();
datetoday.setTime(timenow);
thehour = datetoday.getHours();
if (thehour > 18) display = "Evening";
else if (thehour >12) display = "Afternoon";
else display = "Morning";
var greeting = ("<b>Good " + display + "!</b>");
document.write(greeting);
//  End -->
</script> - 

Should result into this;
For screenshots, please visit this post: http://yaldaram.com/showthread.php?tid=167
(2011-01-07, 04:28 PM)Yaldaram Wrote: [ -> ]Go to: ACP > Templates > Header Templates > header_welcomeblock_member > and find;
{$lang->welcome_back}

and before it, add the following;
<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Robert Ison -->
<!-- Web Site:  http://www.infosourcetraining.com -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
datetoday = new Date();
timenow=datetoday.getTime();
datetoday.setTime(timenow);
thehour = datetoday.getHours();
if (thehour > 18) display = "Evening";
else if (thehour >12) display = "Afternoon";
else display = "Morning";
var greeting = ("<b>Good " + display + "!</b>");
document.write(greeting);
//  End -->
</script> - 

Should result into this;
For screenshots, please visit this post: http://yaldaram.com/showthread.php?tid=167
Thank you, +rep.
Ive used this script (with permission) and turned it into a plugin (Free plugin) : http://www.mybbextras.com/showthread.php?tid=717
Thanks.