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)

sabret00the 11-16-2005 10:00 PM

Nicer Greeting On NavBar
 
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

Quote:

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

Quote:

Originally Posted by NuclioN
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 Code:

<php

$ng_hour 
date('G');
$ng_now bcadd($ng_hour4);
$ng_result bcadd($ng_now5); 

?> 

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

HTML Code:

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

HTML Code:

<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

HTML Code:

<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

Quote:

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

Quote:

Originally Posted by sabret00the
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 Code:

<php

$ng_hour 
date('G');
$ng_now bcadd($ng_hour4);
$ng_result bcadd($ng_now5); 

?> 

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

Quote:

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

PHP Code:

$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

Quote:

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

Quote:

Originally Posted by christianb
One thing that doesn't make sense to me...

PHP Code:

$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

Quote:

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

Quote:

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

Quote:

Originally Posted by Vizionz
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.

PHP Code:

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

Should have a space after Evening,

PHP Code:

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

Also, would something like this work?
PHP Code:

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:
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 01:31 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.01630 seconds
  • Memory Usage 1,877KB
  • 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
  • (3)bbcode_html_printable
  • (13)bbcode_php_printable
  • (11)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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