![]() |
Automatic Birthday Thread
This hack is inspired by the Birthday Hack for vB2 by Logician. It will automatically create a Happy Birthday thread in a specified forum, listing the people with birthdays for that day. Then other members can post their happy birthday wishes in the thread.
I had the original hack installed on my VB2 board and when I upgraded to VB3 my members missed it. Luckily, it's really easy to implement. -------------------------------------- Files to modify: /includes/cron/birthday.php -------------------------------------- Instructions are in the attached text file. The mod should take about 5 minutes. Be sure to change the variables that say // CHANGE ME You can customize the message in the $birthday_greeting_thread variable. You could also ad IMG tags with an image of some kind, like in my screenshot. Note that you MUST turn on BB CODE in you birthday forum in order for this to work properly. -------------------------------------- Enjoy (and thanks for the inspiration, Logician!) -------------------------------------- New in Version 2.0: Bug fixes: > More accurate age calculation. Sometimes it was a year off. > The correct thread shows up in the last thread post on the forum home page. > HTML is not required to be turned on in the birthday forum. > Most of the code is completely rewritten to vB3 standards. New features: > Improved look > Birthday line now says: (User) was born on (date), (AGE: xx) > If the year is not given, it says "Not telling! :)" for age. > The admin is emailed a list of the birthdays with links to their profiles and a link to the happy birthday thread. > If you use the uShop/uCash hack, you can give birthday points to the users Upgrading: Since the code has changed so drastically, I suggest starting with a fresh copy of birthday.php and following the instructions for a new install. |
Very cool idea :)
|
Yes almost like the old vb2 hack :) Very very good :)
|
no working :(
Happy Birthday Email Parse error: parse error in /home/httpd/vhosts/dominio.com/httpdocs/foros/includes/cron/birthday.php on line 59 All Done in line 59 is this $birthday_greeting_thread = <<< EOF total php birthday Code:
<?php |
niiiiiiiiiiice hack.. i will def. install this sometime this week and for Vb-Hispano, this hack is for v3, your profile says you use v2
|
I use v 3.0
|
Is it possible to specify only specific users groups that it selects birthdays from, and if not any possibility of the option in a future version?
|
Quote:
I get the same error as well...Forced to uninstall... |
Cool hack, thx for the vb3 update
|
This is cool. Could you add a .txt file as well?
|
I've done the following modifications and it works fine now. Enhanced the title a little too.
-------------------------------------- UNDER PHP Code:
ADD PHP Code:
UNDER PHP Code:
ADD PHP Code:
|
not bad, although if you could get it to make individual threads it would be even better
|
Quote:
Not Working There seems to have been a slight problem with the Foros xxxxxxxxx database. Please try again by pressing the refresh button in your browser. An E-Mail has been dispatched to our Technical Staff, who you can also contact if the problem persists. We apologise for any inconvenience. :( :disappointed: |
Quote:
|
i`d love to see instructions file attached to first post ;)
|
For those of you having errors, there were some spaces added to the queries when I pasted the code (??). I've attached instructions in a text format. Copy from there and it should work.
MK@spug.net: Nice addition sabret00the: To create individual threads for each birthday, just move the step 3 code up underneath the $bday_people = .... line. It should work, but I haven't tried it. As far as usergroups, I'm still getting the hang of VB3. :) Enjoy, |
thanx a lot man! ;)
|
Quote:
I rather have a cron file that run once per month to insert a new thread for the birthdays of that month. This way members can congratulate and others have time to participate. |
Actually, the topics change every day... e.g. "Happy Birthday to our members on DATE", etc. And with MK@spug.net's version it changes even more: "Happy Birthday to user, user, user on date". I set aside a sub-forum just for birthdays so it stacks up there. :)
Quote:
|
Just curious, how are you testing this? I see some people saying they are getting errors? Wouldn;t it run behind the scenes via cron?
|
In your admin cp under scheduled tasks, you can choose to "run now" for any cron job. It's really useful for testing.
|
Quote:
$birthday_greeting_thread = <<< EOF It is bad syntax. Its also bad coding form. |
hmmm.... I see that method used all the time. It doesn't cause errors even if it's considered bad syntax. What would you suggest (aside from calling a vb template)? :ermm:
|
I did go ahead and change the $birthday_greeting_thread into a single line variable instead of using <<< EOF EOF; tags, but that format is used quite frequently. I'm not sure why it would cause an error. PhotoPost makes liberal use of this type of format and it's taught in PHP books.... ??? :ermm:
|
use it for vbb Gold ,, don't work ,
|
Great hack! I've got too many birthdays to print all the names in the title but I'm using the rest of MK@spug.net's changes. Very easy install on vb3 gold (if you're having errors check to see if your mysql insert has extra spaces).
|
yes, working in gold
thanks :D |
Hmm...this hack works fine on Gold, however the thread doesn't show up on the forumhome, just inside the forum. Also, the thread count doesn't rise when new threads are made. (I just installed this hack, so it only has one thread posted...yet the forum for the BDay threads still has '0' as the thread count...even though the reply count is there.
Is this supposed to happen, and can it be fixed? Thanks! |
Good point. I left out a couple of line of code from Logician's original hack. Add these lines right above // End Create Birthday Thread Hack
PHP Code:
Quote:
|
Thanks ChurchMedia and Logician!
That worked perfectly. :) |
HTML Code:
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,postusername,postuserid,lastpos ter,dateline,iconid,visible,attach) VALUES (NULL,'".addslashes(htmlspecialchars($title3))."','".time()."','$greetings_forum','1','0','".addslashes($greeter_name)."','$greeter','".addslashes($greeter_name)."','".time()."','0','1','0')"); then you have to change this: HTML Code:
INSERT INTO thread to INSERT INTO yourprefix_thread HTML Code:
INSERT INTO post to INSERT INTO yourprefix_post |
Quote:
:) |
Strange, i ran the Happy Birthday email and got no errors but I had a birthday and gor a email :
Database error in vBulletin 3.0.0 Release Candidate 4: Invalid SQL: INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,postuserid,lastpos ter,dateline,iconid,visible,attach) VALUES (NULL,'Happy Birthday to on March 21, 2004','1079867961','6','1','0','Happy Birthday','11064','Happy Birthday','1079867961','0','1','0') mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ter,dateline,iconid,visible,attach) VALUES (NULL,'Happy Birthda mysql error number: 1064 Any ideas what is wrong?? Thanks! |
Be sure to change the user id,user name and forum id variables. If they don't exist you will get an error. Looks like you might have used example variables (from MK@spug.net). Let me know if you still have problems after changing these:
$greeter=1; //Your User ID $greeter_name="Your User Name"; //Your User Name $greetings_forum=1; //enter the forum id that you want the thread to go into |
Quote:
AAHHh YEs I didn;t read that closely enough. . . :nervous: Thanks for the reply! ryan\ |
Quote:
|
To show the age (in years)...
In includes/cron/birthday.php find: Code:
$emails .= iif($emails, ', '); Code:
// Generate Age Code:
$bday_people .= "<a href=\"member.php?u=".$userinfo['userid']."\">".$username."</a>, born ".$userinfo['birthday']."\n"; Code:
$bday_people .= "<a href=\"member.php?u=".$userinfo['userid']."\">".$username."</a>, Age: ".$age."\n"; |
Very cool! Thanks for that addition. Here's an addition to email the greeter when the thread is created (it will email the birthday greeting).
Find: Code:
$greeter=1; //His User ID Below that add: Code:
$greetermail="youremail@yourdomain.com"; Find: Code:
$DB_site->query("UPDATE user SET posts=posts+1 WHERE userid=$greeter"); Code:
// email the admin |
Here's an addition to give users store points for their birthday:
Find: Code:
$bday_title .= $username.", "; Code:
$DB_site->query("UPDATE user SET storep=storep+50 where userid='$userinfo[userid]'"); You can change the "50" to however many points you want to give for a birthday present. Be sure to mention the present in your birthday greeting. :) |
church media one request if possible - can this be set to ignore zero posters ?
|
All times are GMT. The time now is 04:46 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|