Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Greetings according to the time of day in the forum

#1
Information 
Greetings according to the time of day in the forum

Hello Darth-Apple Hello folks, My question to you about my small adjustment in the forum, greeting after day / night time in the Mybb forum.
It was important to me not to generate it according to the server time, but according to the user-specific set time zone in the user Cp.
I managed to do that.
How far I have errors in the whole, I ask you to point out and to improve.


instructions:

####################################################
Code:
add you and you in the global language file English and German
]I have it right under (about line 38 be more or less) this
$l['welcome_current_time'] = "<strong>Current time:</strong> {1}";
HERE:

German:

$l['welcome_back_night'] = "<strong>Gute Nacht {1}</strong> - Letzter Besuch: {2}";
$l['welcome_back_morning'] = "<strong>Guten Morgen {1}</strong> - Letzter Besuch: {2}";
$l['welcome_back_day'] = "<strong>Guten Tag {1}</strong> - Letzter Besuch: {2}";
$l['welcome_back_evening'] = "<strong>Guten Abend {1}</strong> - Letzter Besuch: {2}";

english

$l['welcome_back_night'] = "<strong>Good Night {1}</strong>. You last visited: {2}";
$l['welcome_back_morning'] = "<strong>Good Morning {1}</strong>. You last visited: {2}";
$l['welcome_back_day'] = "<strong>Good Day {1}</strong>. You last visited: {2}";
$l['welcome_back_evening'] = "<strong>Good Evening {1}</strong>. You last visited: {2}";


###################
then change the main directory global.php
###################

Code:
gobal.php

replace line 530:

$lang->welcome_back = $lang->sprintf($lang->welcome_back, build_profile_link(htmlspecialchars_uni($mybb->user['username']), $mybb->user['uid']), $lastvisit);

replaced with:

//Begin Time welcome Tc4me
$uhrzeit = gmdate($mybb->settings['timeformat'],TIME_NOW + $mybb->user['timezone'] * 3600);
if ($uhrzeit >= 0 && $uhrzeit < 4) 
{
$lang->welcome_back = $lang->sprintf($lang->welcome_back_night, build_profile_link(htmlspecialchars_uni($mybb->user['username']), $mybb->user['uid']), $lastvisit);
}
elseif ($uhrzeit < 10 && $uhrzeit >= 4)
{
$lang->welcome_back = $lang->sprintf($lang->welcome_back_morning, build_profile_link(htmlspecialchars_uni($mybb->user['username']), $mybb->user['uid']), $lastvisit);
}
elseif ($uhrzeit <= 18 && $uhrzeit >= 10)
{
$lang->welcome_back = $lang->sprintf($lang->welcome_back_day, build_profile_link(htmlspecialchars_uni($mybb->user['username']), $mybb->user['uid']), $lastvisit);
}
  else//if ($uhrzeit >= 19)
{
$lang->welcome_back = $lang->sprintf($lang->welcome_back_evening, build_profile_link(htmlspecialchars_uni($mybb->user['username']), $mybb->user['uid']), $lastvisit);
}
//End Time welcome Tc4me


Please take a look at that and if necessary, please improve it!

Greets Tc4me


 
[Image: autism4all.png]
[x] <= Drive in nail here for new display!
Reply


Messages In This Thread
Greetings according to the time of day in the forum - by tc4me - February 3rd, 2021 at 2:09 PM



Users browsing this thread: 1 Guest(s)

Dark/Light Theme Selector

Contact Us | Makestation | Return to Top | Lite (Archive) Mode | RSS Syndication 
Proudly powered by MyBB 1.8, © 2002-2024
Forum design by Makestation Team © 2013-2024