Announcement

Collapse
No announcement yet.

[release] birthday in thread

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [release] birthday in thread

    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
    Last edited by Mas*Mind; Fri 15 Jun '01, 6:04pm.

  • #2
    nice one dude.. Look alright that does.

    do you have a demo?

    Comment


    • #3
      You can see it in action on my forum.

      Great hack. you did a good job on it.
      Bid For Power - Bid For Power Forums
      =======================
      Anime Academy - Anime Academy Forums

      Comment


      • #4
        just installed it, works great, thanks!
        What do you Listen-To? http://www.listen-to.com

        i <3 vBulletin.

        Comment


        • #5
          Thanks Mas*Mind

          Comment


          • #6
            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?

            Comment


            • #7
              Same here

              Mines on line 26......

              Comment


              • #8
                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")."\";");

                Comment


                • #9
                  new error

                  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?

                  Comment


                  • #10
                    Working for me. Thanks for the revised code.

                    Maverick, what errors are you getting now?

                    Chris

                    Comment


                    • #11
                      this one

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

                      Comment


                      • #12
                        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

                        Comment


                        • #13
                          RIGHT!

                          Right u are-thanks 4 helping me

                          Comment


                          • #14
                            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
                            Last edited by Dakota; Fri 15 Jun '01, 10:34pm.
                            Bid For Power - Bid For Power Forums
                            =======================
                            Anime Academy - Anime Academy Forums

                            Comment


                            • #15
                              Well its not displaying it correctly, so I will put it in this attachment.
                              Bid For Power - Bid For Power Forums
                              =======================
                              Anime Academy - Anime Academy Forums

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...
                              X