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

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

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

$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

Quote:

Originally Posted by Keyser S?ze
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 />


PHP Code:

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

$ng_result bcadd($ng_date$ng_tz_useroffset); 

with this:
PHP Code:

$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


All times are GMT. The time now is 10:37 PM.

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.01444 seconds
  • Memory Usage 1,774KB
  • 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
  • (6)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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