PDA

View Full Version : Nicer Greeting On NavBar


sabret00the
11-16-2005, 10:00 PM
Ok i can't take too much credit for it, the original concept was by omgli3k back on the vb3 days i think and even then back at RC stages :o anyway as a thank you check out his site http://empathogen.net/

Onto the hack, this hack changes the greeting and it's all done automatically and sweetly. it takes your users timezone and gives a greeting dependant on that: "Good Morning, $username.", "Good Afternoon. $username." or "Good Evening, $username.".

shweet huh ;) lol

ok without further ado here you go.

upload as a product.

Thanks again to omgli3k for leading the way on this one :)

NuclioN
11-17-2005, 10:01 AM
Not working :( It doesn't show up

davidw
11-17-2005, 10:05 AM
I like this

* christianb clicks install

sabret00the
11-17-2005, 10:11 AM
Not working :( It doesn't show up

uploaded the correct version :)

NuclioN
11-17-2005, 10:36 AM
Call to undefined function bcadd() error

sabret00the
11-17-2005, 10:41 AM
Call to undefined function bcadd() error

what version of php are you running?

because bcadd is a stock function

NuclioN
11-17-2005, 10:46 AM
PHP Version 5.0.5

sabret00the
11-17-2005, 10:56 AM
ouch at php5

ok could you try this

make a php file (that's just a text file with a .php extention instead) with the contents being this
<php

$ng_hour = date('G');
$ng_now = bcadd($ng_hour, 4);
$ng_result = bcadd($ng_now, 5);

?>

upload it and run it and tell me if you still get the undefined function error please.

edit: heh i just noticed i'm running 5.0.4 on my localhost and it works there :(

Rickie3
11-17-2005, 11:50 AM
have you got a screenshot? will install this later thanx

SB2002
11-17-2005, 02:14 PM
Great hack, used to use this on my old VB3.0.1 way back when.

However, I found that i had to change a line in the code to keep the font smaller on the navbar. I changed this

<div style="padding: 0.5em;" nowrap="nowrap">

to this

<div class="smallfont">

this was in VB 3.5.1 I dunno if it's because of another hack I already have installed or not, but using the origional code blew out the small font and made it normal sized.

sabret00the
11-17-2005, 03:18 PM
i would suggest

<div style="padding: 0.5em;" nowrap="nowrap" class="smallfont">

SB2002
11-17-2005, 03:36 PM
ah thay tidies it up a bit, thanks :)

Mastar
11-17-2005, 05:35 PM
Just one problem, it is 3PM here and it is still saying Goodmorning. Any thought?

sabret00the
11-17-2005, 05:40 PM
Just one problem, it is 3PM here and it is still saying Goodmorning. Any thought?

wheres your server?
what's the server offset?
and last but not least what's your personal usertime offset?

Snake
11-17-2005, 08:56 PM
/me installs

NuclioN
11-17-2005, 09:06 PM
ouch at php5

ok could you try this

make a php file (that's just a text file with a .php extention instead) with the contents being this
<php

$ng_hour = date('G');
$ng_now = bcadd($ng_hour, 4);
$ng_result = bcadd($ng_now, 5);

?>

upload it and run it and tell me if you still get the undefined function error please.

edit: heh i just noticed i'm running 5.0.4 on my localhost and it works there :(

No error now but it's strange...when viewing the source code it shows exactly the php code in it. I'll wait, maybe you'll find a way to let this work. ;)

moonclamp
11-17-2005, 09:16 PM
What is the time cut off for saying good evening?

My server is in London, I'm on GMT at 11:10pm and set my profile to 12 hours in advance making it 11.10am and it still said good evening.

However it worked fine when I went backwards 12 hours

Mastar
11-17-2005, 11:21 PM
I uninstalled untill bugs fixed!

moonclamp
11-17-2005, 11:45 PM
I uninstalled untill bugs fixed!

Me too ... regrettably as it's a nice idea.

davidw
11-18-2005, 12:06 AM
One thing that doesn't make sense to me...

$ng_tz_serveroffset = $vbulletin->options['timeoffset'];
$ng_tz_useroffset = $vbulletin->userinfo['timezoneoffset'];

$ng_hour = date('G');
$ng_now = bcadd($ng_hour, $ng_serveroffset);
$ng_result = bcadd($ng_now, $ng_tz_useroffset);
in the first line of code: $ng_tz_serveroffset
in the fourth (or fifth depending on if you count the blank line): $ng_serveroffset

Vizionz
11-18-2005, 01:48 AM
Call to undefined function bcadd() error
same error here

Chris M
11-18-2005, 01:58 AM
It seems sabe has made a typo :)

Try replacing that variable that christianb reported and see if that may fix your error - As for a call to an undefined function, not sure how that could be corrected :ermm:

Chris

sabret00the
11-18-2005, 08:53 AM
One thing that doesn't make sense to me...

$ng_tz_serveroffset = $vbulletin->options['timeoffset'];
$ng_tz_useroffset = $vbulletin->userinfo['timezoneoffset'];

$ng_hour = date('G');
$ng_now = bcadd($ng_hour, $ng_serveroffset);
$ng_result = bcadd($ng_now, $ng_tz_useroffset);
in the first line of code: $ng_tz_serveroffset
in the fourth (or fifth depending on if you count the blank line): $ng_serveroffset

big typo, that's that's giving evryone problems, oops. i'll upload a fixed version.

Xzyte
11-18-2005, 08:55 AM
Great work, installed nice, works on the forum but now it doesn't show any greating in vBa portal.

sabret00the
11-18-2005, 09:00 AM
Great work, installed nice, works on the forum but now it doesn't show any greating in vBa portal.

not sure why that'd happen, it works across several directories on my localhost, though it's untested above the forums directory.

Xzyte
11-18-2005, 09:08 AM
not sure why that'd happen, it works across several directories on my localhost, though it's untested above the forums directory.
Thank you for your fast reply. I will have a look at the vBa templates later tonight, maybe I can find the variable to replace there.

Vizionz
11-18-2005, 09:42 AM
tell me when you upload a fixed file cause i sytill getting the
Fatal error: Call to undefined function: bcadd() in global.php(356) : eval()'d code on line 49

sabret00the
11-18-2005, 09:50 AM
tell me when you upload a fixed file cause i sytill getting the
Fatal error: Call to undefined function: bcadd() in global.php(356) : eval()'d code on line 49

the uploaded file is up. but i'll see if i can get one of the higher powers to take a look at this.

davidw
11-18-2005, 09:59 AM
If I get a chance this morning, I may break the code and see what I can do.

<phrase name="ng_goodevening"><![CDATA[Good Evening,]]></phrase>
Should have a space after Evening,

<phrase name="ng_goodevening"><![CDATA[Good Evening, ]]></phrase>

Also, would something like this work?
if ($ng_result < 18){
if ($ng_result < 12) {
$ng_greeting = "<strong>" . $vbphrase[ng_goodmorning] . " " . $vbulletin->userinfo[username] . ".</strong>";
}
else {
$ng_greeting = "<strong>" . $vbphrase[ng_goodafternoon] . " " . $vbulletin->userinfo[username] . ".</strong>";
}
else {
$ng_greeting = "<strong>" . $vbphrase[ng_goodevening] . " " . $vbulletin->userinfo[username] . ".</strong>";
}
I just woke up about 30 mins ago, so please bare with me :P

Keyser S?ze
11-18-2005, 03:04 PM
this installed fine, but no matter what time it is, all it says is good morning

Good Morning, Ice.
You last visited: Today at 12:02 PM
Private Messages: Unread 0, Total 545.

davidw
11-18-2005, 03:38 PM
What time was it when you saw the greeting?

davidw
11-18-2005, 03:56 PM
This * might * fix it:
Find:
$ng_tz_serveroffset = $vbulletin->options['timeoffset'];
$ng_tz_useroffset = $vbulletin->userinfo['timezoneoffset'];

$ng_hour = date('G');
$ng_now = bcadd($ng_hour, $ng_tz_serveroffset);
$ng_result = bcadd($ng_now, $ng_tz_useroffset);
Replace with:
$ng_date = date("G");
$ng_tz_useroffset = $vbulletin->userinfo['timezoneoffset'];
$ng_result = bcadd($ng_date, $ng_tz_useroffset);


This is what I have from working on it:
$ng_date = date("G");
$ng_tz_useroffset = $vbulletin->userinfo['timezoneoffset'];
$ng_result = bcadd($ng_date, $ng_tz_useroffset);

$ng_greeting = "ERROR";

if($ng_result < 12){
$ng_greeting = "<strong>" . $vbphrase[ng_goodmorning] . " " . $vbulletin->userinfo[username] . ".</strong>";
} elseif($ng_result < 18){
$ng_greeting = "<strong>" . $vbphrase[ng_goodafternoon] . " " . $vbulletin->userinfo[username] . ".</strong>";
}else {
$ng_greeting = "<strong>" . $vbphrase[ng_goodevening] . " " . $vbulletin->userinfo[username] . ".</strong>";
}
// Nicer Greeting On NavBar

Mastar
11-18-2005, 04:13 PM
this installed fine, but no matter what time it is, all it says is good morning

Good Morning, Ice.
You last visited: Today at 12:02 PM
Private Messages: Unread 0, Total 545.

Same here:

Good Morning, Water.
You last visited: Today at 01:03 PM
Private Messages: Unread 0, Total 2

davidw
11-18-2005, 04:17 PM
Here's my latest edits (in case someone else wants to try it):

I've somewhat modified the instructions:

first off go to your navbar template and find:
==============================================
<div style="padding: 0.5em;" nowrap="nowrap">
<strong><phrase 1="$bbuserinfo[username]">$vbphrase[welcome_x]</phrase></strong><br />
==============================================

and replace that with
<div style="padding: 0.5em;" nowrap="nowrap">
<strong>$ng_greeting</strong><br />


<plugins>
<plugin active="1">
<title>Nicer Greeting On NavBar</title>
<hookname>global_start</hookname>
<phpcode><![CDATA[// Nicer Greeting On NavBar

$ng_date = date("G");
$ng_tz_useroffset = $vbulletin->userinfo['timezoneoffset'];
$ng_result = bcadd($ng_date, $ng_tz_useroffset);

$ng_greeting = "ERROR";

if($ng_result < 12){
$ng_greeting = "<phrase 1="$bbuserinfo[username]">" . $vbphrase[ng_goodmorning] . " . </phrase>";
} elseif($ng_result < 18){
$ng_greeting = "<phrase 1="$bbuserinfo[username]">" . $vbphrase[ng_goodafternoon] . " . </phrase>";
}else {
$ng_greeting = "<phrase 1="$bbuserinfo[username]">" . $vbphrase[ng_goodevening] . " . </phrase>";
}
// Nicer Greeting On NavBar
]]></phpcode>
</plugin>
</plugins>
<phrases>
<phrasetype name="GLOBAL" fieldname="global">
<phrase name="ng_goodafternoon"><![CDATA[Good Afternoon, {1}]]></phrase>
<phrase name="ng_goodevening"><![CDATA[Good Evening, {1}]]></phrase>
<phrase name="ng_goodmorning"><![CDATA[Good Morning, {1}]]></phrase>
</phrasetype>
</phrases>

Edit: forgot semicolon after "ERROR"

sabret00the
11-18-2005, 05:38 PM
nice work, christianb, i'll look that over as soon as i get a chance.

as for people with the bcadd() problem. ask your host to enable bcmath in your configuration.

you can check if it's enabled or not via your phpinfo.

Vizionz
11-18-2005, 11:45 PM
still getting the error after Techs has installed php-bcmath-5.0.4-1mdk.i586.rpm on your server.

davidw
11-19-2005, 12:51 AM
just a thought on the bcadd issue...

replacing this:
$ng_result = bcadd($ng_date, $ng_tz_useroffset);

with this:
$ng_result = $ng_date + $ng_tz_useroffset;
(old php stuff might work here, may not work - I haven't tried it)

Edit (forgot to remove ")")

Mastar
11-20-2005, 02:22 PM
Update: The welcome changed today fro 'Good Morning' to 'Good Afternoon' only it was still morning do I changed 12 to 18 and 18 to 12 and I got the 'Good Morning' message. Will wait til later today or tomorrow to see if it changes correctly.

davidw
11-20-2005, 05:40 PM
Only curiuos...

Where is the server in location to your website? If it is in a different time zone, this will have to be taken into consideration.

Mastar
11-20-2005, 06:14 PM
It is in Japan

davidw
11-20-2005, 07:05 PM
It is in JapanGMT +9

What time zone are you accessing it from?

Mastar
11-20-2005, 08:32 PM
GMT +9

What time zone are you accessing it from?

GMT -5

davidw
11-20-2005, 10:17 PM
14 hour difference...
do you have in account for dailight savings? Is it saying Good Afternoon as you are at 11:00 am, or a different time before 11:00 am?

ogden2k
11-21-2005, 12:49 AM
Server -5
Me: -5

9:50PM and getting Good Morning....

davidw
11-21-2005, 08:10 AM
Server -5
Me: -5

9:50PM and getting Good Morning....Have you tried replacing the part in the xml file as in the second part of this (https://vborg.vbsupport.ru/showpost.php?p=824723&postcount=32)?

The reason I'm asking is that I think for some reason its taking the server time and subtracting the server time (adding the -x) and then subtracting the timezone offset. I could have the formula wrong too, of course.

9:50pm -5 (GMT-5) = 4:50pm -5 (individual timezone GMT-5) = 11:50 am = "Good Morning" +/- daylight savings. Does that make sense?

Iceburg22
11-21-2005, 12:33 PM
works for me! installed

Mastar
11-21-2005, 02:11 PM
Have you tried replacing the part in the xml file as in the second part of this (https://vborg.vbsupport.ru/showpost.php?p=824723&postcount=32)?

The reason I'm asking is that I think for some reason its taking the server time and subtracting the server time (adding the -x) and then subtracting the timezone offset. I could have the formula wrong too, of course.

9:50pm -5 (GMT-5) = 4:50pm -5 (individual timezone GMT-5) = 11:50 am = "Good Morning" +/- daylight savings. Does that make sense?

Just did that edit, just have to wait til pm my time and see...

MThornback
11-22-2005, 01:13 PM
Just one problem, it is 3PM here and it is still saying Goodmorning. Any thought?

Mine is doing this too...it dosen't appear to be reading the GMT time only the server/board time...are you willing to patch it so that it does GMT? :speechless:

PsiNyde
11-22-2005, 04:14 PM
if you are looking for a more permanent [non-dynamic] greeting, simply change the welcome_x prase [page 32 in global phrases] to something like "Yo, wessep {1}"



I tried this plugin as well, with bad results. I'm not knocking the script, it's a great idea! Once it's working properly, I'll certainly use it.

davidw
11-22-2005, 05:27 PM
I'm wondering if a variable could be created out of current user time (the same time that displays the timestamp on the forums when someone posts). That would take out the guesswork on the formulas.

davidw
11-22-2005, 07:16 PM
I have fixed it - at least on my site

// Nicer Greeting On NavBar

$ng_gmt = date('G') + 6; // add + or - and the difference between the server and GMT. My time zone is GMT-6 so I add 6

$ng_tz_useroffset = $vbulletin->userinfo['timezoneoffset'];
$ng_result = bcadd($ng_gmt, $ng_tz_useroffset);

if($ng_result < 12){
$ng_greeting = "<strong>" . $vbphrase[ng_goodmorning] . " " . $vbulletin->userinfo[username] . ".</strong>";
} elseif($ng_result < 18){
$ng_greeting = "<strong>" . $vbphrase[ng_goodafternoon] . " " . $vbulletin->userinfo[username] . ".</strong>";
} else {
$ng_greeting = "<strong>" . $vbphrase[ng_goodevening] . " " . $vbulletin->userinfo[username] . ".</strong>";
}

// Nicer Greeting On NavBar

NuclioN
11-22-2005, 08:21 PM
Does this also solve the bcadd error christian?

davidw
11-22-2005, 08:28 PM
bcadd is php(server) related issue. I think a suitable workaround might be (offhand since I haven't tried it)...

// Nicer Greeting On NavBar

$ng_gmt = date('G') + 6; // add + or - and the difference between the server and GMT. My time zone is GMT-6 so I add 6

$ng_tz_useroffset = $vbulletin->userinfo['timezoneoffset'];
// $ng_result = bcadd($ng_gmt, $ng_tz_useroffset); Replace this with:
$ng_result = $ng_gmt + $ng_tz_useroffset;

if($ng_result < 12){
$ng_greeting = "<strong>" . $vbphrase[ng_goodmorning] . " " . $vbulletin->userinfo[username] . ".";
} elseif($ng_result < 18){
$ng_greeting = "<strong>" . $vbphrase[ng_goodafternoon] . " " . $vbulletin->userinfo[username] . ".";
} else {
$ng_greeting = "<strong>" . $vbphrase[ng_goodevening] . " " . $vbulletin->userinfo[username] . ".";
}

// Nicer Greeting On NavBar

Mastar
11-22-2005, 11:13 PM
I have fixed it - at least on my site

// Nicer Greeting On NavBar

$ng_gmt = date('G') + 6; // add + or - and the difference between the server and GMT. My time zone is GMT-6 so I add 6

$ng_tz_useroffset = $vbulletin->userinfo['timezoneoffset'];
$ng_result = bcadd($ng_gmt, $ng_tz_useroffset);

if($ng_result < 12){
$ng_greeting = "<strong>" . $vbphrase[ng_goodmorning] . " " . $vbulletin->userinfo[username] . ".</strong>";
} elseif($ng_result < 18){
$ng_greeting = "<strong>" . $vbphrase[ng_goodafternoon] . " " . $vbulletin->userinfo[username] . ".</strong>";
} else {
$ng_greeting = "<strong>" . $vbphrase[ng_goodevening] . " " . $vbulletin->userinfo[username] . ".</strong>";
}

// Nicer Greeting On NavBar


I think that fixed it:

<?xml version="1.0" encoding="ISO-8859-1"?>

<product productid="nicergreeting" active="1">
<title>Nicer Greeting On NavBar</title>
<description>This adds a nicer greeting to your navbar.</description>
<version>1.0.1</version>
<codes>
</codes>
<templates>
</templates>
<plugins>
<plugin active="1">
<title>Nicer Greeting On NavBar</title>
<hookname>global_start</hookname>
<phpcode><![CDATA[// Nicer Greeting On NavBar

$ng_gmt = date('G') + 8;

$ng_tz_useroffset = $vbulletin->userinfo['timezoneoffset'];
$ng_result = bcadd($ng_gmt, $ng_tz_useroffset);

if($ng_result < 12){
$ng_greeting = "<strong>" . $vbphrase[ng_goodmorning] . " " . $vbulletin->userinfo[username] . ".</strong>";
} elseif($ng_result < 18){
$ng_greeting = "<strong>" . $vbphrase[ng_goodafternoon] . " " . $vbulletin->userinfo[username] . ".</strong>";
} else {
$ng_greeting = "<strong>" . $vbphrase[ng_goodevening] . " " . $vbulletin->userinfo[username] . ".</strong>";
}

// Nicer Greeting On NavBar]]></phpcode>
</plugin>
</plugins>
<phrases>
<phrasetype name="GLOBAL" fieldname="global">
<phrase name="ng_goodafternoon"><![CDATA[Good Afternoon, ]]></phrase>
<phrase name="ng_goodevening"><![CDATA[Good Evening,]]></phrase>
<phrase name="ng_goodmorning"><![CDATA[Good Morning, ]]></phrase>
</phrasetype>
</phrases>
<options>
</options>
</product>

NuclioN
11-23-2005, 07:56 AM
bcadd is php(server) related issue. I think a suitable workaround might be (offhand since I haven't tried it)...


I think it's working now. Thanks. :)

Vizionz
11-23-2005, 12:06 PM
bcadd is php(server) related issue. I think a suitable workaround might be (offhand since I haven't tried it)...

// Nicer Greeting On NavBar

$ng_gmt = date('G') + 6; // add + or - and the difference between the server and GMT. My time zone is GMT-6 so I add 6

$ng_tz_useroffset = $vbulletin->userinfo['timezoneoffset'];
// $ng_result = bcadd($ng_gmt, $ng_tz_useroffset); Replace this with:
$ng_result = $ng_gmt + $ng_tz_useroffset;

if($ng_result < 12){
$ng_greeting = "<strong>" . $vbphrase[ng_goodmorning] . " " . $vbulletin->userinfo[username] . ".";
} elseif($ng_result < 18){
$ng_greeting = "<strong>" . $vbphrase[ng_goodafternoon] . " " . $vbulletin->userinfo[username] . ".";
} else {
$ng_greeting = "<strong>" . $vbphrase[ng_goodevening] . " " . $vbulletin->userinfo[username] . ".";
}

// Nicer Greeting On NavBar


thanks that worked :)

i attached the fixed version for bcad

davidw
11-23-2005, 12:39 PM
Glad to have helped - I hope you don't mind sabert00th

sabret00the
11-23-2005, 01:33 PM
not at all, i'm just leaving you to it :)

spongebobrox128
11-23-2005, 02:15 PM
There is another solution besides adding the timezone offset to make it GMT. Look-up the function gmdate(); gmdate() gives you the time in GMT rather than in the server time. From the Vizionz' XML, replace
$ng_gmt = date('G') + 6; // add + or - and the difference between the server and GMT. My time zone is GMT-6 so I add 6
with
$ng_gmt = gmdate('G'); #get the time in GMT
and it should work just as fine as adding the timezone offset to the time. :)

C_P
11-23-2005, 10:20 PM
Weel, I liked the idea and clicked install but do not care to edit files to compensate for my time zone when others may have same issue just so it stops saying goodmorning even though it is 4:20 pm here.
I have to click uninstall and wait for a more complete mod. Sorry.

Vizionz
11-23-2005, 10:25 PM
well damn did you ever run version 3 or below :( that little edit is nothing

C_P
11-23-2005, 10:29 PM
I just installed today/this morning and it still shows goodmorning.
I have no idea what to edit and where at this point there are so many try this in the thread I got lost.

Vizionz
11-23-2005, 10:32 PM
did you have the bcad error at all ?

C_P
11-23-2005, 10:33 PM
nope

Vizionz
11-23-2005, 10:39 PM
try this xml file

C_P
11-23-2005, 10:45 PM
Wit no additional file edits correct? Other than the template navbar change :
replace that with
<div style="padding: 0.5em;" nowrap="nowrap">
$ng_greeting<br Correct?

Vizionz
11-23-2005, 10:46 PM
yeah no edits i did the edit for ya just do the navbar edit

C_P
11-23-2005, 10:49 PM
I just added it and it shows "Good Morning, CP." It is 4:50 pm here....

Vizionz
11-23-2005, 10:52 PM
try this one

Vizionz
11-23-2005, 10:54 PM
remember to overwrite the product

C_P
11-23-2005, 10:54 PM
I thank you much for trying but I just uninstalled the last one, and reinstalled this one, selecting to OVERWRITE, I hit refresh on my home page and:
Good Morning, CP. still.

C_P
11-23-2005, 10:59 PM
FYI, at the bottom of my board it shows:
All times are GMT -8. The time now is 04:57 PM.

Vizionz
11-23-2005, 11:02 PM
one last try if this one dont say good afternoon or good evening i give up and just uninstall till someone figures it out :P

Vizionz
11-23-2005, 11:05 PM
i added this one to +8

$ng_gmt = date('G') + 6; // add + or - and the difference between the server and GMT. My time zone is GMT-6 so I add 6

in the one i just attached it was +12 to just make sure it changed

Vizionz
11-23-2005, 11:05 PM
so if neither of them work i give up and uninstall it till someone else can figure it out :) i tried hehe

C_P
11-23-2005, 11:06 PM
I sincerely appreciate you trying, but after an uninstall of the last one, and a new upload of this one allowing overwrite: Good Morning, CP.
How frustrating. Could it be our board refresh rate or something?

C_P
11-23-2005, 11:08 PM
Wait, you uploaded another as I was posting. Let me try the + one you just added

Vizionz
11-23-2005, 11:12 PM
also do you have your time zone in your user cp the same as in your boards admin area

C_P
11-23-2005, 11:14 PM
I just tried latest and same issue. My user CP shows GMT -8 and my board CP shows GMT -8

Vizionz
11-23-2005, 11:16 PM
okay its a negative so maybe me adding aa plus is messing it up one last try

Vizionz
11-23-2005, 11:16 PM
that one is - 8 instead of +8

C_P
11-23-2005, 11:20 PM
Good Morning, CP even after logging out and then in. I am soooo sorry man. I do not know.

Vizionz
11-23-2005, 11:21 PM
me either i tried all the fixes in this thread different times + and minus i would just uninstall it till somneone else has a clue why i am sorry i tried all i could

C_P
11-23-2005, 11:25 PM
You did more than try! Thank you very much for the personal service but not sure what the issue is. I know you are probably wondering if I really did remove, and upload each new one and I did allowing to overwrite each time just in case. T o prove it, here is the file I upped last:

C_P
11-24-2005, 01:33 AM
Vizionz you are a master helper! After multiple tries we got it!
Back to clicking install! This is great!

Vizionz
11-24-2005, 01:42 AM
glad i could help now offf to see the wizard the wizard of sleep

C_P
11-25-2005, 01:20 AM
Well, unfortunately, it said Good Evening all day long and now in evening on this hack and never changed from Good Evening, CP :(

amykhar
11-25-2005, 02:13 AM
I'm going to share the one I'm testing on my board now. (I was always getting good morning too with this one)

Mine is very simple code.

First, it gets the user's time.

$nghourdiff = $vbulletin->options['hourdiff'];
$ng_time = TIMENOW -$nghourdiff;


Then, it gets it as the hour in a 24 hour format

$ng_result = date('G',$ng_time);


Then, it goes on to figure out if this is morning, afternoon or night.

The product is attached.

C_P
11-25-2005, 02:32 AM
Amy, I uninstalled and installed yours and right away it shows (with a little text addition):
Welcome Back & Good Evening, CP
Considering my time time now is 08:30 PM .... it looks like yours may rock from the start as do most of your excellent modifications (I do not like to call them hacks because it devalues all you coders hard work) on my site!!

*I'll update this in the morning to know for sure..

amykhar
11-25-2005, 02:41 AM
I should know in about 15 minutes if it's working. It's about to be midnight here. I'm crossing my fingers :)

C_P
11-25-2005, 02:53 AM
I'll await your word..

amykhar
11-25-2005, 03:02 AM
It's saying good morning now.

C_P
11-25-2005, 03:05 AM
I rest my case, You Rock!
I'll let ya know tomorrow on my site but I am sure Amy, your products never seem to fail me!

MThornback
11-25-2005, 11:58 AM
It's saying good morning now.


Amy thanks :) saved me from losing this...cause I really liked it :D

and thanks to sabret00the for the concept :D

Detomah
11-25-2005, 12:46 PM
I'm going to share the one I'm testing on my board now. (I was always getting good morning too with this one)

Working perfectly for me now. :)

C_P
11-25-2005, 04:37 PM
I rest my case, You Rock!
I'll let ya know tomorrow on my site but I am sure Amy, your products never seem to fail me!
Well Amy as suspected......
I worked like a Charm!
A nice Welcome Back & Good Morning, CP was there to say hello this morning to me!
*Is there a addition you could add to include knowing what day of the week it is for the user as well? This way, it would display things like T.G.I.F for Fridays, and Happy Hump Day for Wednesdays, and Monday morning back to work, and Saturday time to play, etc?

amykhar
11-25-2005, 06:48 PM
That's easy. You would just need to do a

$ng_day = date('l',$ng_time);


After the
$ng_result = date('G',$ng_time);


and use $ng_day in the template.

Amy

C_P
11-25-2005, 11:36 PM
Thanks very much for the reply and how to but I better wait for the pros to do that modification with the xml as I am excellent at screwing things up and terrible at implimenting.
I do have a question Amy, my navbar shows Good Afternoon, CP and the time now is 05:35 PM. Shouldn't the 5 pm time turn it to Good Evening?

C_P
11-26-2005, 12:06 AM
6 pm looks like when evening announcement kicks in..

Noonster
12-08-2005, 08:15 AM
In the install it says:
<div style="padding: 0.5em;" nowrap="nowrap">
$ng_greeting<br />

But all I can find thats similar is:
<td class="alt2" valign="top" nowrap="nowrap">
<div class="smallfont">
<strong><phrase 1="$bbuserinfo[username]">$vbphrase[welcome_x]</phrase></strong><br />

Any ideas?? Thanks!

davidw
12-08-2005, 09:52 AM
The second part is supposed to be replaced by the first part.

sabret00the
12-09-2005, 11:48 AM
I'm going to share the one I'm testing on my board now. (I was always getting good morning too with this one)

Mine is very simple code.

First, it gets the user's time.

$nghourdiff = $vbulletin->options['hourdiff'];
$ng_time = TIMENOW -$nghourdiff;


Then, it gets it as the hour in a 24 hour format

$ng_result = date('G',$ng_time);


Then, it goes on to figure out if this is morning, afternoon or night.

The product is attached.

you should release it amy, i'll redirect everyone from here to your thread.

Noonster
12-09-2005, 07:53 PM
The second part is supposed to be replaced by the first part.

Sorry not following you ??

Noonster
12-09-2005, 08:02 PM
^^ Forget the above sorted it....

Installed - great :D

davidw
12-09-2005, 08:03 PM
:D good

Devil Woman
01-11-2006, 11:50 AM
is there a way to get this to work with 3.5.2 as the code i have to look for to replace is different to what says in the template navbar

Thanks

Club3G
01-12-2006, 03:10 PM
thanks that worked :)

i attached the fixed version for bcad

That's working on 3.5.3. Thanks to all. :)

* Club3G clicks install

amykhar
01-12-2006, 03:31 PM
you should release it amy, i'll redirect everyone from here to your thread.

Go ahead and take it Saber. :) It's just your hack with a bug fix.

Amy

Club3G
01-12-2006, 08:30 PM
Eep, I spoke too soon.

It's working great on my forums, but on my portal, there's nothing there at all.

(Searched this thread for "portal", didn't see a fix).

Club3G
01-15-2006, 02:33 AM
Uninstalling. Great mod, but no portal support is no good.

Masked Crusader
01-16-2006, 08:35 PM
Alright, having a problem here. All I can get the mod to do is state "Good Morning, [Username]"...what am I do wrong? It does not change at ALL!

Club3G
01-16-2006, 09:37 PM
Alright, having a problem here. All I can get the mod to do is state "Good Morning, [Username]"...what am I do wrong? It does not change at ALL!

Read the whole thread.

https://vborg.vbsupport.ru/showpost.php?p=830056&postcount=88

https://vborg.vbsupport.ru/showpost.php?p=827968&postcount=51

Eagle Creek
01-20-2006, 08:59 AM
Hi!

I installed it, I like it. But.. It doesn't seem to work very well. At about 11 am it says 'good afternoon' and it says already 'good evening' at , about, 4 pm..

So it doesn't fits with the time. Is this a setting to be made?

davidw
01-20-2006, 10:40 AM
Is your sever time different than your board's time? If so, you'll need to compensate +/- 1 or 2 hours depending on the time difference.

Eagle Creek
01-20-2006, 10:42 AM
Is your sever time different than your board's time? If so, you'll need to compensate +/- 1 or 2 hours depending on the time difference.

No it isn't. The server and the board are both on GMT+1, DTS automatic.
But I'll check the server time, just to be sure.

davidw
01-20-2006, 10:50 AM
One reason I ask is that one time I noticed that my server time was reporting a 2 hour difference although they were both located in the same room. Another time I had a 1 hour difference before that because the server was located in Canada (GMT-5) and I was in central US (GMT-6).

Eagle Creek
01-21-2006, 02:11 PM
Look:

Good Evening, Eagle Creek.
All times are GMT +1. The time now is 17:11.

In my opinion you start to say evening when it's + 6.PM//18.00 hour.

davidw
01-21-2006, 03:13 PM
What do you have in your xml file? Can you paste that here?

Eagle Creek
01-21-2006, 11:47 PM
What do you have in your xml file? Can you paste that here?

What do I have to post exactly?

// Nicer Greeting On NavBar

$ng_tz_serveroffset = $vbulletin->options['timeoffset'];
$ng_tz_useroffset = $vbulletin->userinfo['timezoneoffset'];

$ng_hour = date('G');
$ng_now = bcadd($ng_hour, $ng_tz_serveroffset);
$ng_result = bcadd($ng_now, $ng_tz_useroffset);

$ng_greeting = "<strong>" . $vbphrase[ng_goodevening] . " " . $vbulletin->userinfo[username] . ".</strong>";

if ($ng_result < 18)
{
$ng_greeting = "<strong>" . $vbphrase[ng_goodafternoon] . " " . $vbulletin->userinfo[username] . ".</strong>";
}

if ($ng_result < 12)
{
$ng_greeting = "<strong>" . $vbphrase[ng_goodmorning] . " " . $vbulletin->userinfo[username] . ".</strong>";
}
// Nicer Greeting On NavBar

davidw
01-22-2006, 12:08 AM
on the line: $ng_hour = date('G');

try changing it to: $ng_hour = date('G') - 1;

Edited - went wrong direction.

bayard88
01-22-2006, 08:50 AM
works great for me, many thanks, sabret00the. ;)

Eagle Creek
01-22-2006, 10:46 AM
on the line: $ng_hour = date('G');

try changing it to: $ng_hour = date('G') - 1;

Edited - went wrong direction.

So do I have to change this? Or is this wrong?

davidw
01-22-2006, 12:53 PM
Try changing it to $ng_hour = date('G') - 1; and see if that works.

Originally I wrote + instead of -.

Eagle Creek
01-22-2006, 01:04 PM
Try changing it to $ng_hour = date('G') - 1; and see if that works.

Originally I wrote + instead of -.

I will :).

davidw
01-24-2006, 11:42 PM
Did this work?

Eagle Creek
01-25-2006, 08:49 AM
Did this work?

Good Afternoon, Eagle Creek.
All times are GMT +1. The time now is 11:48.

Guess not..

davidw
01-25-2006, 11:29 AM
I'm thinking something here.

Can you paste here what code is listed where it says:

Good Afternoon, Eagle Creek.
All times are GMT +1. The time now is 11:48.I want to see what actual code provides this statement.

Eagle Creek
01-25-2006, 11:35 AM
I'm thinking something here.

Can you paste here what code is listed where it says:

Good Afternoon, Eagle Creek.
All times are GMT +1. The time now is 11:48.I want to see what actual code provides this statement.

I don't understand? What code do I have to post?
The source from my webbrowser?

davidw
01-25-2006, 02:47 PM
It's located in your navbar template. For example, the instructions suggest to replace a certain part of your navbar template with this code:

<div style="padding: 0.5em;" nowrap="nowrap">
$ng_greeting<br /> - I need to know what is listed 1-2 lines before and after that in the template.

Eagle Creek
01-25-2006, 03:13 PM
<if condition="$show['member']">

<td class="alt2" valign="top" nowrap="nowrap">
<div class="smallfont">
$ng_greeting<br />
<phrase 1="$pmbox[lastvisitdate]" 2="$pmbox[lastvisittime]">$vbphrase[last_visited_x_at_y]</phrase>
<if condition="$show['pmstats']"><br /><phrase 1="$vbphrase[unread_x_nav_compiled]" 2="$vbphrase[total_x_nav_compiled]" 3="$session[sessionurl_q]">$vbphrase[private_messages_nav]</phrase></if>
</div>

davidw
01-25-2006, 03:17 PM
What code are you using (and where) to produce this statement:

All times are GMT +1. The time now is 11:48.

I don't see it in the code you posted earlier, nor in this recent code from the navbar template.

Eagle Creek
02-07-2006, 02:39 PM
What code are you using (and where) to produce this statement:

All times are GMT +1. The time now is 11:48.

I don't see it in the code you posted earlier, nor in this recent code from the navbar template.

Good Evening, Eagle Creek.
All times are GMT +1. The time now is 17:38.
========

What code exact do you want to view?

davidw
02-07-2006, 03:28 PM
Whatever it is that produces the statement "All times are GMT +1. The time now is 17:38"
It sounds like it is working, but is off by an hour or two. We need to find out where the hour offset is coming from.

Raydar
02-08-2006, 11:56 PM
Hi

The code we are supposed to remove is not in my navbar template.

<div style="padding: 0.5em;" nowrap="nowrap">
<strong><phrase 1="$bbuserinfo[username]">$vbphrase[welcome_x]</phrase></strong><br />


I have something similar to that code.


<td class="alt2" valign="top" nowrap="nowrap">
<div class="smallfont">
<strong><phrase 1="$bbuserinfo[username]">$vbphrase[welcome_x]</phrase></strong><br />


Is it safe to remove this code and add the hack even though it is slightly different?

Thanks

Reg

davidw
02-09-2006, 01:32 AM
My suggestion on that would be to first copy this part to something like notepad or somewhere that is accessable and then remove the code and add the hack as you suggested. :) - The original code to be removed is from the default style I believe and your style, as mine, will differ. If it doesn't work, just replace what you removed with what you copied out. :)

AFMichael
02-09-2006, 02:11 AM
I'm going to share the one I'm testing on my board now. (I was always getting good morning too with this one)

Mine is very simple code.

First, it gets the user's time.

$nghourdiff = $vbulletin->options['hourdiff'];
$ng_time = TIMENOW -$nghourdiff;


Then, it gets it as the hour in a 24 hour format

$ng_result = date('G',$ng_time);


Then, it goes on to figure out if this is morning, afternoon or night.

The product is attached.


This absolutely worked! Thanks very much!

Raydar
02-09-2006, 04:40 AM
Thanks Christianb. Good Idea. Yeah it worked but the new font is larger than the original and looks strange.

Which part of the code should I modify to keep the same font sizes?

Thanks again

Reg

Luggruff
02-09-2006, 08:26 AM
doesn't seem that you have updated the readme according to what has been written in this thread.

About the smallfont class on the <div style="padding: 0.5em;" nowrap="nowrap"> etc.

And since my code is:
<td class="alt2" valign="top" nowrap="nowrap">
<div class="smallfont">
<strong><phrase 1="$bbuserinfo[username]">$vbphrase[welcome_x]</phrase></strong><br />
<phrase 1="$pmbox[lastvisitdate]"

then this doesn't make any sence to me:

<div style="padding: 0.5em;" nowrap="nowrap">
<strong><phrase 1="$bbuserinfo[username]">$vbphrase[welcome_x]</phrase></strong><br />

or this:

<div style="padding: 0.5em;" nowrap="nowrap">
$ng_greeting<br />

and I tried to replace the <phrase 1="$bbuserinfo[username]">$vbphrase[welcome_x]</phrase></strong><br /> with $ng_greeting<br />, then uploading the plugin.. but all that happened was that my forum shut down and gave me the message:

Fatal error: Call to undefined function: bcadd() in /home/virtual/hlforum.net/public_html/global.php(349) : eval()'d code on line 24

I've tested this:
<php

$ng_hour = date('G');
$ng_now = bcadd($ng_hour, 4);
$ng_result = bcadd($ng_now, 5);

?>
..and get no error there.

Raydar
02-09-2006, 10:23 AM
Hi Luggruf,

The install.txt document that came in the zip file for this download, says that this code is to be removed -

<div style="padding: 0.5em;" nowrap="nowrap">
<strong><phrase 1="$bbuserinfo[username]">$vbphrase[welcome_x]</phrase></strong><br />

But I don't have matching code for that. I have this -

<td class="alt2" valign="top" nowrap="nowrap">
<div class="smallfont">
<strong><phrase 1="$bbuserinfo[username]">$vbphrase[welcome_x]</phrase></strong><br />

I may have slightly different code because I have a flashing gif image for when people receive private messages.

Once I removed that code and replaced it with this code which is the replacement code in the install.txt document that comes in the zip folder for this pluggin.

<div style="padding: 0.5em;" nowrap="nowrap">
$ng_greeting<br />

It seems to work but the font is larger. I want it to look the same as it did before. But I'm not sure what code needs to be changed to make the font the same size.

I don't get any error messages.

Also, I'm not sure what you mean by this code.

<php

$ng_hour = date('G');
$ng_now = bcadd($ng_hour, 4);
$ng_result = bcadd($ng_now, 5);

?>

Thanks

Reg

Luggruff
02-09-2006, 10:49 AM
Hi Luggruf,

The install.txt document that came in the zip file for this download, says that this code is to be removed -

<div style="padding: 0.5em;" nowrap="nowrap">
<strong><phrase 1="$bbuserinfo[username]">$vbphrase[welcome_x]</phrase></strong><br />

But I don't have matching code for that. I have this -

<td class="alt2" valign="top" nowrap="nowrap">
<div class="smallfont">
<strong><phrase 1="$bbuserinfo[username]">$vbphrase[welcome_x]</phrase></strong><br />

I may have slightly different code because I have a flashing gif image for when people receive private messages.

Once I removed that code and replaced it with this code which is the replacement code in the install.txt document that comes in the zip folder for this pluggin.

<div style="padding: 0.5em;" nowrap="nowrap">
$ng_greeting<br />

It seems to work but the font is larger. I want it to look the same as it did before. But I'm not sure what code needs to be changed to make the font the same size.

I don't get any error messages.

Also, I'm not sure what you mean by this code.

<php

$ng_hour = date('G');
$ng_now = bcadd($ng_hour, 4);
$ng_result = bcadd($ng_now, 5);

?>

Thanks

Reg


hmm, strange then.

Ahh, it was another user that wrote it:

ouch at php5

ok could you try this

make a php file (that's just a text file with a .php extention instead) with the contents being this
<php

$ng_hour = date('G');
$ng_now = bcadd($ng_hour, 4);
$ng_result = bcadd($ng_now, 5);

?>

upload it and run it and tell me if you still get the undefined function error please.

edit: heh i just noticed i'm running 5.0.4 on my localhost and it works there :(

Raydar
02-09-2006, 11:41 AM
Cool

Can anyone tell me wha the 0.5em in the code below does please?

<div style="padding: 0.5em;" nowrap="nowrap">
$ng_greeting<br />

Cheers

Luggruff
02-09-2006, 11:50 AM
Cool

Can anyone tell me wha the 0.5em in the code below does please?

<div style="padding: 0.5em;" nowrap="nowrap">
$ng_greeting<br />

Cheers

sets the size of the padding.. it's the same as #px.. only another format

Sooner95
02-09-2006, 12:24 PM
Works like a champ! Thx

Eagle Creek
02-09-2006, 07:42 PM
Whatever it is that produces the statement "All times are GMT +1. The time now is 17:38"
It sounds like it is working, but is off by an hour or two. We need to find out where the hour offset is coming from.

But that's a normal vB function, build in.
I copy that indication from the bottom of my forum.

guvner
02-11-2006, 03:53 AM
I should know in about 15 minutes if it's working. It's about to be midnight here. I'm crossing my fingers :)Hi Amy - I used your code for this and whilst it works just fine - it seems to have affected the "You last visited" function on the line below the welcome - in other words the time of my last login only increments if I log out and back in again.

If I stay logged in - the time doesn't change, even though I might have been back and forth several times.

Any ideas?

Thanks - Mike :)

Saskia
02-11-2006, 10:09 AM
This is a great hack! Thanks a lot for the great work. I had to use Amy's version, because it would say "Good Morning" at all times. I've added in a "Good Night" one for 12am-6am, if anyone's interested.

It's attached below.

Luggruff
02-11-2006, 10:25 AM
haha ! It finally works! Thanks Saskia !
(dunno what's different with that xml file o_0)

davidw
02-11-2006, 01:59 PM
But that's a normal vB function, build in.
I copy that indication from the bottom of my forum.Have you tried Amy's version of the product to see if that fixes it - since her's uses a different approach than mine?

Sooner95
02-12-2006, 03:26 PM
thank you Amy, applied your update as well and it works great now.

thelittleguy
02-15-2006, 09:59 PM
Uhh yeah I downloaded this hack on my board once before but we ran into some server issues so we had to remove some hacks and I re downloaded the hack again and uploaded it and its stuck on good morning no matter the time I went through this tread and tried pretty much alll of the suggestions to fix it and noticed on this download only two lines of code for each section show and all the suggestions dont match any codes in this thread i have supplied a txt of the dl

davidw
02-15-2006, 11:45 PM
You may want to find this:

$vbphrase[welcome_x]

and replace it with this:

$ng_greeting

Also, which (specifically) suggestions did you try - by post?

Eagle Creek
05-05-2006, 01:08 PM
Good Evening, Eagle Creek.
Alle tijden zijn GMT +2. De tijd is nu 16:06. (=4.04 PM)

Already???

A_N_K_A_R_A
06-24-2006, 07:05 PM
very nice thanks

futuredood
06-28-2006, 03:09 PM
how can we implement this in usercp?

sabret00the
08-20-2006, 09:29 PM
how can we implement this in usercp?
what do you mean?

LordDB
09-04-2006, 01:32 AM
For v3.6 GOLD replace with this:

<td class="alt2" valign="top" nowrap="nowrap">
<div class="smallfont">
<strong><phrase $ng_greeting<br />

Cheers!;)

steve1386
10-25-2006, 11:59 AM
Is there a version of this for 3.6.2 please guys..

Saskia
01-01-2007, 11:27 PM
The one Amy posted a couple pages back (and I posted a page back with a small edit) works fine on vB 3.6.x. I'm running 3.6.4 and it still works like a charm!

For v3.6 GOLD replace with this:

<td class="alt2" valign="top" nowrap="nowrap">
<div class="smallfont">
<strong><phrase $ng_greeting<br />

Cheers!;)

Actually, you got an error right there with an open phrase tag. :)

storpappa
02-16-2007, 12:27 AM
Installed with the updated XMl from Saskia - thanks. I saw an update to this as code in style rather thena product, and rightly so got directed back to this mod.

Smoothie
02-16-2007, 12:54 AM
I integrated this with the "Display Unread Posts" mod from Paul. :)

Jamie1
08-12-2007, 11:17 AM
This is really effective :) Nice one

fukdawrld
04-02-2008, 10:26 AM
would be nice if you can combine with the welcome panel re-write in the same box

theparentpack
09-09-2008, 07:18 AM
Not sure how to edit the navbar template for 3.7.3. Any ideas? I would love to use this hack!