Login Register






Time-oriented login messages. // MyBB filter_list
Author
Message
Time-oriented login messages. // MyBB #1
Go to your Admin CP > Templates & Style > Your Theme Template > Header Templates > header_welcomeblock_member.

Here we will add this code (I put the messages in Japanese, it's in order. 1 - Still awake I see. 2 - Good morning! 3 - Good day! 4 - Good evening! 5 - Good night!):
Code:
{ document.write("<b>私はあγͺγŸγŒγΎγ γ ε‚η…§γ—γ¦γγ γ•γ„γ€‚ </b>"); } else if (n < 10) { document.write("<b>γŠγ―γ‚ˆγ†γ”γ–γ„γΎγ™οΌ</b>"); } else if (n < 16) { document.write("<b>δΈ€ζ—₯良い!</b>"); } else if (n < 20) { document.write("<b>こんばんは!</b>"); } else { document.write("<b>γŠγ‚„γ™γΏγͺさい!</b>"); } //--> </script>

Next, remove your welcomeblock, it looks like this:
Code:
{$lang->welcome_back}

You will place the following code in place of the welcome block:
Code:
<a href="{$mybb->settings['bburl']}/member.php?action=profile" id="edit_post_{$post['pid']}" > <strong> {$mybb->user['username']} </strong >

Original: Burned Designs
Found On: This place
[Image: BXqGARG.png]

Reply

RE: Time-oriented login messages. // MyBB #2
Sincerely I think this is useless for internacional forums, yet for national forums it would be cool.
Thanks for the tutorial.
[Image: 5IN9GdK.png]

Reply

RE: Time-oriented login messages. // MyBB #3
(02-18-2014, 03:41 PM)mig4ng Wrote: Sincerely I think this is useless for internacional forums, yet for national forums it would be cool.
Thanks for the tutorial.

Depends if it takes forum time, set timezone, or local time for a result.

Most things I've seen like this use the user set timezone, can't say exactly what this one does, but in general its just for a little fun "Hey, thanks for coming back" type message.
telegram: @satan_sl

Reply

RE: Time-oriented login messages. // MyBB #4
(02-18-2014, 05:22 PM)Satan Wrote: Depends if it takes forum time, set timezone, or local time for a result.

Most things I've seen like this use the user set timezone, can't say exactly what this one does, but in general its just for a little fun "Hey, thanks for coming back" type message.

It doesn't though if you actually took a look at what he's doing. It's all his own Javascript. No PHP -- How could you interact with the user's set local time configured via UserCP? In addition to that, he didn't even post the full code because it's missing the first if block.



This would be a stupid way of doing it IMO... MyBB variables do exist. A better way would be to look at the $mybb->user['timezone'] and $mybb->user['dst'] variables and edit the PHP directly.

(original) global.lang.php:
Code:
$l['welcome_back'] = "<strong>Welcome back, {1}</strong>. You last visited: {2}";

(original) global.php:
Code:
$lang->welcome_back = $lang->sprintf($lang->welcome_back, build_profile_link($mybb->user['username'], $mybb->user['uid']), $lastvisit);

(modified) global.lang.php:
Code:
$l['welcome_back'] = "<strong>{1}, {2}</strong>. You last visited: {3}";

(modified) global.php:
Code:
$dyn_welcome_msg = ''; // use $mybb->user['timezone'] and $mybb->user['dst'] here // check time // decide what to display for $dyn_welcome_msg $lang->welcome_back = $lang->sprintf($lang->welcome_back, $dyn_welcome_msg, build_profile_link($mybb->user['username'], $mybb->user['uid']), $lastvisit);

This way it would be based on the local time set by the user in the UserCP.
-- cxS

[ Haskell/.NET/C/C++ - Software Engineer ]

Reply

RE: Time-oriented login messages. // MyBB #5
(02-22-2014, 11:36 PM)cxS Wrote: This would be a stupid way of doing it IMO... MyBB variables do exist. A better way would be to look at the $mybb->user['timezone'] and $mybb->user['dst'] variables and edit the PHP directly.

(original) global.lang.php:
Code:
$l['welcome_back'] = "<strong>Welcome back, {1}</strong>. You last visited: {2}";

(original) global.php:
Code:
$lang->welcome_back = $lang->sprintf($lang->welcome_back, build_profile_link($mybb->user['username'], $mybb->user['uid']), $lastvisit);

(modified) global.lang.php:
Code:
$l['welcome_back'] = "<strong>{1}, {2}</strong>. You last visited: {3}";

(modified) global.php:
Code:
$dyn_welcome_msg = ''; // use $mybb->user['timezone'] and $mybb->user['dst'] here // check time // decide what to display for $dyn_welcome_msg $lang->welcome_back = $lang->sprintf($lang->welcome_back, $dyn_welcome_msg, build_profile_link($mybb->user['username'], $mybb->user['uid']), $lastvisit);

You do realize that I didn't create this, right? I only copied it over.
[Image: BXqGARG.png]

Reply

RE: Time-oriented login messages. // MyBB #6
(02-22-2014, 11:37 PM)Duubz Wrote: You do realize that I didn't create this, right? I only copied it over.

Who cares? It's still a bad way of doing it regardless of who created this idea. I don't enforce government politics but that doesn't mean I don't share my ideas with others that didn't enforce them either... And while you copied it you missed a part of it at the beginning.
-- cxS

[ Haskell/.NET/C/C++ - Software Engineer ]

Reply

RE: Time-oriented login messages. // MyBB #7
(02-22-2014, 11:49 PM)cxS Wrote: Who cares? It's still a bad way of doing it regardless of who created this idea.

Not really 'bad' but there's just a better way of doing it.
[Image: BXqGARG.png]

Reply

RE: Time-oriented login messages. // MyBB #8
(02-22-2014, 11:50 PM)Duubz Wrote: Not really 'bad' but there's just a better way of doing it.

How is it not bad? It's by pure coincidence that it's going to match the set local timezone via the MyBB UserCP, thus inaccuracy or not being synced with the time that matters kind of makes the resulting text based on it's *own* time a bit useless doesn't it? Plus you're deleting MyBB implementation to override it with some less effective javascript...

With my way of doing it, you still have MyBB functionality in-tact. It doesn't become unusable after the modification.
-- cxS

[ Haskell/.NET/C/C++ - Software Engineer ]

Reply