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;
If one wants to use different languages or greetings depending on language settings, one can also insert the script code *inside* the language variable (in global.lang.php)
(2011-04-19, 08:21 AM)linguist Wrote: [ -> ]If one wants to use different languages or greetings depending on language settings, one can also insert the script code *inside* the language variable (in global.lang.php)
Didn't tested it on global lang file.
(2011-04-19, 08:21 AM)linguist Wrote: [ -> ]If one wants to use different languages or greetings depending on language settings, one can also insert the script code *inside* the language variable (in global.lang.php)
Yes, you can use PHP in the language files, as it are just PHP files.
In global.lang.php
$l['welcome_back'] = "<strong>Good ".(my_date("G","","",false) > 17 ? "evening " : (my_date("G","","",false) > 12 ? "afternoon" : (my_date("G","","",false) > 6 ? "morning" : "night"))).", {1}</strong>. You last visited: {2}";
Great idea.
I assume this works according to the forum's time settings?
(2011-04-19, 10:33 AM)faviouz Wrote: [ -> ]I assume this works according to the forum's time settings?
My modification works according to the time settings from the current user on your forum, yes. You can test it by changing the timezone in your UserCP.
Yaldarim's modification works according to the browser's time settings.
Hi,
I'm using this, and I have a 24 hour clock, only problem is me and some other people are getting this:
- ,George! - You last visited: Today, 19:47 PM (User CP — Mod CP — Log Out)
I believe it's only in the evenings, any ideas why?
welcomeblock_member template:
<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> -
,{$lang->welcome_back} (<a href="{$mybb->settings['bburl']}/usercp.php"><strong>{$lang->welcome_usercp}</strong></a>{$modcplink}{$admincplink} — <a href="{$mybb->settings['bburl']}/member.php?action=logout&logoutkey={$mybb->user['logoutkey']}">{$lang->welcome_logout}</a>)<br />
<span class="links">
<a href="#" onclick="MyBB.popupWindow('{$mybb->settings['bburl']}/misc.php?action=buddypopup', 'buddyList', 350, 350);">{$lang->welcome_open_buddy_list}</a>
</span>
<a href="{$mybb->settings['bburl']}/search.php?action=getnew">{$lang->welcome_newposts}</a> | <a href="{$mybb->settings['bburl']}/search.php?action=getdaily">{$lang->welcome_todaysposts}</a> | <a href="search.php?action=finduserthreads&uid={$mybb->user['uid']}">View my threads</a> | <a href="search.php?action=finduser&uid={$mybb->user['uid']}">View my posts</a> | <a href="{$mybb->settings['bburl']}/private.php">{$lang->welcome_pms}</a> {$lang->welcome_pms_usage}