vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   birthday in thread (https://vborg.vbsupport.ru/showthread.php?t=20344)

Mas*Mind 06-14-2001 10:00 PM

Description: This hack prints some message or displays a picture in a post when that particular user has a birthday on that moment.

Version tested: 2.01, but will probaby work on all 2.0 versions

instructions:

  1. Create a new file called birthday.php with the following content:

    <?php

    $today_day = date("d",mktime(date("H"),date("i"),date("s"),date ("m"),date("d"),date("Y"))+($bbuserinfo[timezoneoffset]-$timeoffset)*3600);
    $today_month = date("m",mktime(date("H"),date("i"),date("s"),date ("m"),date("d"),date("Y"))+($bbuserinfo[timezoneoffset]-$timeoffset)*3600);
    $today_year = date("Y",mktime(date("H"),date("i"),date("s"),date ("m"),date("d"),date("Y"))+($bbuserinfo[timezoneoffset]-$timeoffset)*3600);
    $userday = explode("-",$post[birthday]);

    if($today_day == $userday[2] && $today_month == $userday[1])
    { $bday = explode("-",$userinfo[birthday]);
    if(date("Y")>$bday[0] and $bday[0]>1901 && $bday[0]!='0000')
    { $birthday = @date($calformat1,mktime(0,0,0,$bday[1],$bday[2],$bday[0]));
    }
    else
    { // lets send a valid year as some PHP3 don't like year to be 0
    // $calformat2 should not contania year identifier so the year doesn't matter
    $birthday = @date($calformat2,mktime(0,0,0,$bday[1],$bday[2],1993));
    }
    if($birthday=="")
    { $birthday="$bday[1]-$bday[2]-$bday[0]";
    }
    if($today_year > $userday[0] && $userday[0] != '0000')
    { $age = $today_year-$userday[0];
    }

    eval ("\$post[has_a_birthday] = \"".gettemplate("postbit_birthday")."\";");
    }

    ?>
  2. create a new template called postbit_birthday

    with some text like:

    Congrats! It's $post[username]'s birthday!

    (you can use the following variables in this template:

    $birthday: Will contain the birthday of the user in a nice format
    $age: Will only contain a value (obviously the age of this user) when the user has filled in his birthyear
  3. backup showthread.php
  4. open showthread.php

    and add:

    // Begin birthdayhack
    include("birthday.php");
    // End birthdayhack


    before:

    eval("\$post[profile] = \"".gettemplate("postbit_profile")."\";");
  5. save showthread.php
  6. insert $post[has_a_birthday] somewhere in the postbit template

enjoy :)

Blue2000 06-15-2001 05:50 PM

nice one dude.. Look alright that does.

do you have a demo?

Dakota 06-15-2001 06:27 PM

You can see it in action on my forum.

Great hack. you did a good job on it.

mister 06-15-2001 06:56 PM

just installed it, works great, thanks!

kicks 06-15-2001 07:37 PM

Thanks Mas*Mind :)

cditty 06-15-2001 09:31 PM

I just tried to install it and I get an error on line 25 of birthday.php.

All I did was cut & paste from here. Wierd.

This is the line:
PHP Code:

eval ("\$post[has_a_birthday] = \"".gettemplate("postbit_birthday")."";"); 

Any ideas?

maverick1236 06-15-2001 10:57 PM

Mines on line 26......

Mas*Mind 06-15-2001 11:49 PM

yup....the [php] code screws code up:

eval ("\$post[has_a_birthday] = \"".gettemplate("postbit_birthday")."";

should be:

eval ("\$post[has_a_birthday] = \"".gettemplate("postbit_birthday")."\";");

maverick1236 06-16-2001 01:08 AM

now the problem is here: in showthread.php
// Begin birthdayhack
include("birthday.php");
// End birthdayhack

something is screwed up with the code here-im getting errors

any ideas?

cditty 06-16-2001 02:15 AM

Working for me. Thanks for the revised code.

Maverick, what errors are you getting now?

Chris

maverick1236 06-16-2001 02:36 AM

Warning: Failed opening 'birthday.php' for inclusion (include_path='') in e:\program files\nusphere\apache\htdocs\upload\showthread.php on line 479

cditty 06-16-2001 02:40 AM

That means that it can't find it. You sure the birthday.php file is there? Could you have named it .php3 by accident?

Chris

maverick1236 06-16-2001 04:13 AM

Right u are-thanks 4 helping me :)

Dakota 06-16-2001 04:28 AM

I had to change
PHP Code:

eval ("\$post[has_a_birthday] = \"".gettemplate("postbit_birthday").""

to

PHP Code:

eval("\$post[has_a_birthday] = \"".gettemplate("postbit_birthday")."\"";"); 

on line 25 of birthday.php

Dakota 06-16-2001 04:34 AM

Well its not displaying it correctly, so I will put it in this attachment.

tazthedev 06-16-2001 05:39 AM

Warning: Failed opening 'birthday.php' for inclusion (include_path='.') in f:\apache\htdocs\divinefxp\showthread.php on line 430

here's the error i got ...

help

Mas*Mind 06-16-2001 09:24 AM

Quote:

Originally posted by tazthedev
Warning: Failed opening 'birthday.php' for inclusion (include_path='.') in f:\apache\htdocs\divinefxp\showthread.php on line 430


here's the error i got ...

help

read a few posts up

Mas*Mind 06-16-2001 09:27 AM

Quote:

Originally posted by Dakota
Well its not displaying it correctly, so I will put it in this attachment.
I know, there's some problem with the [php]-code... I allready changed my original instructions

Sarge 06-19-2001 07:34 AM

does this slow down the page loading much?
anyone know?

Mas*Mind 06-19-2001 09:59 AM

nope, not noticable anyway

TigerLily 06-20-2001 03:08 PM

Awesome hack! It didn't work for me in 2.0, but as soon as I upgraded to 2.01 it worked beautifully. Thank you so much!
TigerLily:)

Alien 09-04-2001 10:04 PM

Do these instructions need any updating? They're not working for me on my 2.0.3 board i'm testing...

For example, the line:

PHP Code:

eval("\$post[profile] = \"".gettemplate("postbit_profile")."\";"); 

Does not exist in showthread.php

I tried to include it in a couple of other places in there (like near the global.php include, but it did not display a thing in threads..

Ideas?

Thanks! :)

Alien 09-04-2001 10:57 PM

Problem solved!

The line mentioned above is located in:

/admin/functions.php

Yay. :) Now works perfectly in 2.0.3!

Great hack!

squawell 09-16-2001 05:34 PM

it's a nice hack~~~

so interesting~~~

thanks your hack it's work very well in my forum!!!

tkhjosh 09-21-2001 09:04 PM

so it wont work on 2.0.0? if not then i am not going to try it :P

cyrus 10-13-2001 02:00 PM

it doesnt owrk in 2.0.3, i cant find what is needed in showthread.php !!!

:( :(

can someone help me add this hack !

Alien 10-13-2001 05:40 PM

Read a few lines up...

cyrus 10-21-2001 07:00 PM

done,. thats fine

but whee do I go to see if this hack is working fine and also where do I upload my birthday.php file ??

+ I do not understand what I have to do in step "6"

can anyone help

thanks

omniweapon 10-21-2001 09:09 PM

PHP Code:

eval("\$post[profile] = \"".gettemplate("postbit_profile")."\";"); 

I can't find that line in functions.php .

Okiewan 01-03-2002 04:59 PM

Quote:

eval("\$post[profile] = \"".gettemplate("postbit_profile")."\";");
Not in showthread or functions in ver 2.2.1

Any update available? Great hack!

Tim Wheatley 02-02-2002 10:32 AM

Works here too. (2.2.2)

Birdie501 05-22-2002 01:34 PM

hi,

can someone tell me what code i have to use when i want to show the age of the user in postbit also if he has no birthday??

Thanks!

afterlab 07-07-2002 09:08 AM

For some reason this doesn't work for me in vBulletin v2.2.6.

Schorsch 08-09-2002 04:25 AM

any advices on this problem with 2.2.6 ?

Schorsch

Diva 09-06-2002 11:31 AM

Hi. Would you mind a little more help with a hack? I have 2.2.7 and really enjoy this hack. The only problem is it won't 'turn off'. So one member is having a 2 day birthday. =/

Any help would be appreciated.


All times are GMT. The time now is 02:54 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.01258 seconds
  • Memory Usage 1,788KB
  • 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
  • (5)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (35)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete