vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Nicer Greeting On NavBar (https://vborg.vbsupport.ru/showthread.php?t=100993)

davidw 11-20-2005 07:05 PM

Quote:

Originally Posted by Mastar
It is in Japan

GMT +9

What time zone are you accessing it from?

Mastar 11-20-2005 08:32 PM

Quote:

Originally Posted by christianb
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

Quote:

Originally Posted by ogden2k
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?

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

Quote:

Originally Posted by christianb
Have you tried replacing the part in the xml file as in the second part of this?

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

Quote:

Originally Posted by Mastar
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

PHP Code:

// 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)...

PHP Code:

// 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

Quote:

Originally Posted by christianb
I have fixed it - at least on my site

PHP Code:

// 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:

Code:

<?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

Quote:

Originally Posted by christianb
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

Quote:

Originally Posted by christianb
bcadd is php(server) related issue. I think a suitable workaround might be (offhand since I haven't tried it)...

PHP Code:

// 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
PHP Code:

$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
PHP Code:

$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 :
Code:

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


All times are GMT. The time now is 11:38 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01417 seconds
  • Memory Usage 1,860KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (6)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete