View Full Version : is there a hack for the birthday on the main page?
jojo85
03-20-2001, 08:51 PM
Ok i want on the main page of the forums juste below :
Welcome to our new......
Happy Birthday to "thename"
where when i click on "thename" i go to a page where i can send him a private message...
Can someone have that?
This wouldn't be hard to do...just look at the template "calendar_birthday" and see how the birthday is called then edit forumhome to include the info.
Ok i will try and send you the instructions after
Originally posted by Dark_Wizard
This wouldn't be hard to do...just look at the template "calendar_birthday" and see how the birthday is called then edit forumhome to include the info.
Don't work need other templates...... :/
I'll look at it later today...
PeF helping me dark
Release:Tonight
When you guys make this hack, do you think it would be possible to make it so you can display it on a non vb page also? Would be very nice to show this on news page as well :D
Originally posted by Bane
When you guys make this hack, do you think it would be possible to make it so you can display it on a non vb page also? Would be very nice to show this on news page as well :D
Yes
I've just cobbled this together for forums/index.php.
1) Open index.php and under the line that starts $templatesused='error_nopermission you need to add this: $templateused.=',calendar_birthday'; then, straight after require('./global.php'); add this: $today = vbdate("m-d",time());
$birthdays = $DB_site->query("SELECT * FROM user WHERE birthday LIKE('%-$today')");
while ($birthday = $DB_site->fetch_array($birthdays)) {
$bd_user = $birthday[username];
$bd_userid = $birthday[userid];
$datebits = explode("-", $birthday[birthday]);
$bdage = date("Y") - $datebits[0];
if ($bdage > 0) $age = "($bdage)";
else $age = "";
eval ("\$todaybirthdays .= \"".gettemplate("calendar_birthday")."\";");
} When you have done that, edit your forumhome template and add $todaybirthdays wherever you want the birthdays to appear.
Using this hack will add one extra query to the main forums page (as you can see).
... and if you want a version for a non-vB page, use this: <?php
require ("./forums/admin/config.php");
$db = mysql_connect('$servername','dbusername','$dbpassw ord');
mysql_select_db('$dbname',$db);
$today = date("m-d",time());
$birthdays = mysql_query("SELECT * FROM user WHERE birthday LIKE('%-$today')",$db) or die (mysql_error());
while ($birthday = mysql_fetch_array($birthdays)) {
$bd_user = $birthday[username];
$bd_userid = $birthday[username];
$datebits = explode("-", $birthday[birthday]);
$bdage = date("Y") - $datebits[0];
if ($bdage > 0) $age = "($bdage)";
else $age = "";
echo "<b><font size=1><a href=\"./forums/member.php?action=getinfo&userid=$bd_userid\">$bd_user's birthday</a> $age</font></b><br>";
}
?> ... remembering to change the path to the forums directory (shown in red).
Kier.. Im gonna learn to play the fiddle so I can write you a song :) Thanks again!
Originally posted by Bane
Kier.. Im gonna learn to play the fiddle so I can write you a song :) Thanks again!
hehe :)
Hmmm...too damn fast...I haven't even looked at the code yet..hehehehe ;)
Damn. I had a meeting and I so wanted to be first... :D
Isn't Kier two-headed? ;)
Originally posted by PeF
Damn. I had a meeting and I so wanted to be first... :D
Isn't Kier two-headed? ;)
lol
too late :D
I found a bug :(
It only lists one birthday -- I have 8 birthdays for today, and it is only listing the last one of the list from the calendar, not all 8
I have verified this on my smaller board too where there are only 5 birthdays -- it is only one person (the last on the list on the calendar.php)
Originally posted by Me2Be
I found a bug :(
It only lists one birthday -- I have 8 birthdays for today, and it is only listing the last one of the list from the calendar, not all 8
I have verified this on my smaller board too where there are only 5 birthdays -- it is only one person (the last on the list on the calendar.php)
Hum.........will ask kier ok?
That shouldn't be too bad. You just need a variable in there that will concatenate the formatted birthdays as it finds them. What if you change the $todaysbirthdays variable to $currentbirthday or something and then after the "eval" line, just make:
$todaysbirthdays .= "$currentbirthday, "
...or something like that? You'd just have to have to figure out the first or last time you went through the list and adjust so you don't have a comma in there at the beginning or the end.
Originally posted by Me2Be
I found a bug :(
It only lists one birthday -- I have 8 birthdays for today, and it is only listing the last one of the list from the calendar, not all 8
I have verified this on my smaller board too where there are only 5 birthdays -- it is only one person (the last on the list on the calendar.php)
Better check for no birthdays so that you don't have "Happy Birthday to: " and then no listings out there.
check:
http://www.20ishparents.com/boards/
Originally posted by jojo85
check:
http://www.20ishparents.com/boards/ I'm not sure what you are trying to show us
Are the birthdays on there somewhere?
Welcome to our newest member, Me2Be.
Today it's the ......
Originally posted by Blackjack
Welcome to our newest member, Me2Be.
Today it's the ......
Yes
When there is a birthday you will see
Today it's the ...... "thename"(age)
Thanks you very much Kier
Thanks you very much jojo85
:)
bokhalifa's birthday (2)
http://daar.bokhalifa.net/bo/
:)
So weird to see forums like that LOL
It's like I'm looking out from inside the browser. :D
The bday hack works if you have one birthday on that date -- I have anywhere from 5 - 20 birthdays on any given day and it will only show one of them.
Hate to make the others feel unloved, you know! :)
Originally posted by Me2Be
The bday hack works if you have one birthday on that date -- I have anywhere from 5 - 20 birthdays on any given day and it will only show one of them.
Hate to make the others feel unloved, you know! :)
Yes miss wait tommorow ;) and you will have a fix version
Change
eval ("\$todaybirthdays = \"".gettemplate("calendar_birthday")."\";");
to
eval ("\$todaybirthdays .= \"".gettemplate("calendar_showbirthdays")."\";");
Originally posted by Kier
Using this hack will add one extra query to the main forums page (as you can see).
This can be avoided by doing a daily cron job, and updating a birthday template. Was it your hack that puts max on line by updating a template? That's a wonderful technique, especially when it can save queries! I've used to post total weight loss for my members (userfields) 3k and growing :)
Of course the cron solution won't catch new users whos birthday is the day theu register, but it can be called from the member.php as well.
Sorry about that bug... it's easy to miss out a concatonator when you've been awake for 30 hours ;)
Originally posted by Kier
Sorry about that bug... it's easy to miss out a concatonator when you've been awake for 30 hours ;)
Are you E.T ? :D
Can you rewrite the code plz with fixed bugs. including the non-vB one. there's a few missed out semi-colons (;) :P i have HARDLY any knowledge of php and i asked evrywhere in IRC to find what was wrong. Someone is Quakenet (#barrysworld) helped and saw it :) the VB version looks good and happy tho :)
Originally posted by freddie
Change
eval ("\$todaybirthdays = \"".gettemplate("calendar_birthday")."\";");
to
eval ("\$todaybirthdays .= \"".gettemplate("calendar_showbirthdays")."\";");
That doesn't fix it completely. If you check my board today. I have 2 birthdays. Both are listed, BUT one of them shouldn't have the age along with it. It seems it just takes the age of the other birthday and attaches it to the one that should not have any age indication.
Listed on Calendar as :
KORYNTHYAN (23)
jokhis
Listed on front page as :
Happy Birthday to: KORYNTHYAN (23) jokhis (23)
i kno i have doen it me not sure if the non-vB works tho. is it right to say No Database Selected?
I've updated both bits of code on the first page of this thread with the relevant fixes for the age and repeat problems.
A database-not-selected message would mean that either the script can't find config.php, or that config.php has an invalid variable name for the database.
Originally posted by Kier
I've updated both bits of code on the first page of this thread with the relevant fixes for the age and repeat problems.
A database-not-selected message would mean that either the script can't find config.php, or that config.php has an invalid variable name for the database.
thx!
yes I had noticed someone forgot to unset the $age but I new someone would quickly see that and fix it.
i really want this fixed for me plz. can u icq me on 79028021 by any chance? (not too clever just started using php. all i kno is include and date things )
Almost there kier. It all shows up correctly, but it puts a <BR> after each person with a birthday. That could be a problem for busy boards that have 5-10 birthdays every day
Originally posted by Castel
Almost there kier. It all shows up correctly, but it puts a <BR> after each person with a birthday. That could be a problem for busy boards that have 5-10 birthdays every day Actually Kier is working on something like this for me which will just use a different template for the front page birthdays.
Originally posted by freddie
yes I had noticed someone forgot to unset the $age but I new someone would quickly see that and fix it.
This hack will be in beta 4?
Originally posted by Me2Be
Actually Kier is working on something like this for me which will just use a different template for the front page birthdays.
Great, I will be needing that also. I don't have that many birthdays yet. But I just opened the vB so not all users have updated profiles just yet. Still I wanted it listed on one line even if it's only 2-3 birthdays.
Templates people. If you edit what you already have to work with you can get what you want.
I've installed an enhanced version of the birthday hack into vbPortal alpha5 release which will be out by this weekend. It displays both today's events and birthdays and uses it's own templates so you can customize them, I was working on this before, but thanks to Kier and Freddie it finally works.
I'm also porting an e-card script so that you will be able to send a birthday card to the birthday boy or girl... that will take a while longer. Possibly next week to get completed.
Originally posted by wajones
I've installed an enhanced version of the birthday hack into vbPortal alpha5 release which will be out by this weekend. It displays both today's events and birthdays and uses it's own templates so you can customize them, I was working on this before, but thanks to Kier and Freddie it finally works.
I'm also porting an e-card script so that you will be able to send a birthday card to the birthday boy or girl... that will take a while longer. Possibly next week to get completed.
I thank you - I thank you - I thank you for all the work you and others are putting into this. I am waiting for the beta or even the most stable alpha release to come out to install this on my active site.
Between this hack and the USENET hack I love it....Way to go..."applause"...:)
Originally posted by freddie
Templates people. If you edit what you already have to work with you can get what you want.
Doh, go easy on me freddie :). I'm still UBB brainwashed. Thanks for the tip and thanks to Kier for the neat little hack. Users are loving it.
OH! look what i did. i fixed it! I knew this was wrong. Late night Kier?
Find this, (at top)
require ("./forums/admin/config.php");
$db = mysql_connect('$servername','dbusername','$dbpassw ord');
mysql_select_db('$dbname',$db);
Replace with,
require("/forums/admin/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
and i'm new to this php stuff too :)
There's nothing wrong with mysql_select_db(xxxxxx,$db);, as you can see here (http://www.php.net/manual/en/function.mysql-select-db.php).
You're right about the single quotes around the connect variables do needing to be removed though :)
i wasnt bothered to type it :p
Originally posted by wajones
I've installed an enhanced version of the birthday hack into vbPortal alpha5 release which will be out by this weekend. It displays both today's events and birthdays and uses it's own templates so you can customize them, I was working on this before, but thanks to Kier and Freddie it finally works.
I'm also porting an e-card script so that you will be able to send a birthday card to the birthday boy or girl... that will take a while longer. Possibly next week to get completed.
Thx Thx you very much :)
There will be a update script?
Here is a slight modification of the code above. Basically all it does it checks to see if there are any birthdays ... if not it writes a message saying "No birthdays today"
<?
require (".forum/admin/config.php"); // add your details here
$db=mysql_connect($servername,$dbusername,$dbpassw ord) or die("Can't open connection to MySQL");
mysql_select_db($dbname) or die("Can't select database");
$today = date("m-d",time());
$birthdays = mysql_query("SELECT * FROM user WHERE birthday LIKE('%-$today')",$db) or die (mysql_error());
if ("$birthdays" != ""){
echo "There are no birthdays today";
} else {
while ($birthday = mysql_fetch_array($birthdays)) {
$bd_user = $birthday[username];
$bd_userid = $birthday[username];
$datebits = explode("-", $birthday[birthday]);
$bdage = date("Y") - $datebits[0];
if ($bdage > 0) $age = "($bdage)";
else $age = "";
echo "<b>? </b><a href=\".forum/member.php?action=getinfo&userid=$bd_userid\">$bd_user's birthday</a> $age<br>"; //add your details here
}
}
?>
simple ... Thanks for the original script !!!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.