February 3rd, 2021 at 2:09 PM
(This post was last modified: February 4th, 2021 at 6:11 AM by tc4me.)
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:
####################################################
###################
then change the main directory global.php
###################
Please take a look at that and if necessary, please improve it!
Greets Tc4me
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