PDA

View Full Version : Looking For Birthday Hack


pifemaster
02-17-2003, 04:31 PM
Hello,

I am very new to this, so please bear with me if my questions seem foolish.

I am a disc jockey & I am setting up a new bulletin board (Vbulletin 2.3.0) which will be a wedding information forum.

I would like to Replace the "birthday" Section of the "edit Profile" page to reflect a "Wedding Date". I can not find where to change the following text in the "edit profile" page:

Birthdate:
If you select your birthday then other forum members will be able to see your birthday on the forum calendar and in your profile. Adding your year of birth is also optional.

I have located & changed the text to display on the Forum home page & the calendar page to show the words "Today's Wedding" instead of "Today's Birthdays" but I'm not sure where else I may need to make these changes.

Any help would be appriciated.

Thank you,
Robert Pfeifer

Xenon
02-17-2003, 04:54 PM
Hmm, the easiest way is to use the searchengine for templates in the cp, just search for birthday and change where needed.

Be sure just to change the text birthday, not any variable names...

pifemaster
02-17-2003, 04:55 PM
Thank you for the quick response,

I will give that a try.

Robert Pfeifer

pifemaster
02-17-2003, 06:22 PM
Xenon,

The tip you gave worked out great. I was able to change all occurances of the word "birthday" to reflect "Wedding".

However, (and you almost had to know there would be a "however" involved, Ha Ha) When I enter an upcoming wedding date (which would be in the future) and I view the user profile, the year is left out (apparently since it is in the future) I would like to change this so it will indicate the year even if in the future. It does show the month & day entered and as long as I enter a date prior to todays date, it does then show the year.

Can you help?

Xenon
02-17-2003, 07:20 PM
you're welcome :)

and yes i know what you mean and i think i can help you :)

open member.php
find:
if (date("Y")>$birthday[0] && $birthday[0]!='0000')
$year = $birthday[0];

and change it to:
if ($birthday[0]!='0000')
$year = $birthday[0];

pifemaster
02-17-2003, 07:52 PM
Xenon,

That worked great for when I go in to view my own profile I now see the year "2004" I entered. However when I click to view another members profile. I still only see the Day & Month and not the 2004.

I would like the 2004 to show up when any member views another members profile so the know if they are getting married in 2004, 2005 Etc.

I do like the results of what you gave me so far, because I was not happy that after you saved a date in your profile, the year disappeared.

Would you know what I would need to edit to view the "Future" year in someone elses public profile.

Thank you very much!!
Robert Pfeifer

pifemaster
02-17-2003, 08:01 PM
Xenon,

I did a little looking in the member.php file that I just changed. I think I might have stumbled on something. I know next to nothing about programing code so I could be in left field but, does the below code possibly affect my situation?

// Birthday Stuff...
if ($calbirthday == 1) {
if ( ($day == -1 and $month != -1) or ($day !=-1 and $month == -1) ) {
eval("standarderror(\"".gettemplate("error_birthdayfield")."\");");
exit;
}
if (($day == -1) and ($month==-1)) {
$birthday = 0;
} else {
if (($year>1901) and ($year<date("Y")))
$birthday = $year . "-" . $month . "-" . $day;
else
$birthday = "0000" . "-" . $month . "-" . $day;
}
} else {
$birthday = 0;

Thank again,
Robert Pfeifer

Xenon
02-17-2003, 08:10 PM
change this:
if (($year>1901) and ($year<date("Y")))

into this:
if ($year>1901) :)

pifemaster
02-17-2003, 08:32 PM
Xenon,

Hate to bother you again, but that did not correct the issue. I did also locate the floowing in the member.php file. This is under the "getinfo" section:

// Set birthday fields right here!
if ($userinfo[birthday] == '0000-00-00') {
$birthday = "N/A";
} else {
$bday = explode("-",$userinfo[birthday]);
if (date("Y")>$bday[0] and $bday[0]>1901 && $bday[0]!='0000') {
$birthday = @date($calformat2,mktime(0,0,0,$bday[1],$bday[2],1993)) . ', ' . $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]";
}
}
eval("\$birthday = \"".gettemplate("getinfo_birthday")."\";");
} else {
$birthday = '';
}

Thank you,
Robert Pfeifer

pifemaster
02-18-2003, 12:13 PM
Xenon,

I played around last night & changed:

if (date("Y")>$bday[0] and $bday[0]>1901 && $bday[0]!='0000')

To this:

if ($bday[0]!='0000')

and it seems to be working great. However, (there's that darn however again) the only other thing I noticed is, when I enter a date in my profile such as "October 16, 2004" it will show up on the calendar under October 16 for every year (as a birthday normally would) I would like to change this to show up on the calendar for 2004 only (or what ever year is entered on their profile). Also, when it shows up on the forum home page under what used to be "Todays Birthdays" I would like it to only show up when the Month, Day & YEAR entered in the profile is = todays date.

I hope you can understand this.

Thanks again,
Robert Pfeifer

Xenon
02-18-2003, 12:57 PM
hmm try this.
open admin/functions.php
find:
// ##################### Save birthdays into template ###################
function getbirthdays() {
global $timeoffset, $DB_site;

$btoday = date("Y-m-d",time()+(-12-$timeoffset)*3600) . '|||';
$btoday .= date("Y-m-d",time()+(12-$timeoffset)*3600) . '|||';

$todayneggmt = date("m-d",time()+(-12-$timeoffset)*3600);
$todayposgmt = date("m-d",time()+(12-$timeoffset)*3600);

$bdays = $DB_site->query("SELECT username,userid,birthday
FROM user
WHERE birthday LIKE '%-$todayneggmt'
OR birthday LIKE '%-$todayposgmt'");

and change to:
// ##################### Save birthdays into template ###################
function getbirthdays() {
global $timeoffset, $DB_site;

$btoday = date("Y-m-d",time()+(-12-$timeoffset)*3600) . '|||';
$btoday .= date("Y-m-d",time()+(12-$timeoffset)*3600) . '|||';

$todayneggmt = date("Y-m-d",time()+(-12-$timeoffset)*3600);
$todayposgmt = date("Y-m-d",time()+(12-$timeoffset)*3600);

$bdays = $DB_site->query("SELECT username,userid,birthday
FROM user
WHERE birthday = '$todayneggmt'
OR birthday = '$todayposgmt'");

pifemaster
02-18-2003, 01:55 PM
Xenon,

I made the change, when I went to my calendar the date still shows up under "each year". When I went to my profile & attempted to change my date to "February 18, 2003" it gave me the following error message:

Database error in vBulletin 2.3.0:

Invalid SQL: SELECT username,userid,birthday
FROM user
WHERE birthday = 2003-02-17'
OR birthday = 2003-02-18'
mysql error: You have an error in your SQL syntax near ''
OR birthday = 2003-02-18'' at line 3

mysql error number: 1064

Any ideas.

Thank you,
Robert Pfeifer

pifemaster
02-18-2003, 02:09 PM
Xenon,

I reinstalled the "original" backup I made of "admin/functions.php" and the error goes away. But date shows up on home page of forum & on calendar for every year.

Thank you,
Robert Pfeifer

Xenon
02-18-2003, 06:41 PM
you've made an mistake and deletete the single ' in front of the $today...

pifemaster
02-18-2003, 07:08 PM
Xenon,

You were very correct. I did screw up & miss the '

I uploaded the new file & now the birthdate does not show up on the home page at all (even if the year is current) & still shows up on the calendar for each year.

Thank you,
Robert Pfeifer

Xenon
02-18-2003, 07:11 PM
hmm weird...

don't have any further ideas..