After a while BDs automatically sets to January 1, 1900. I have set my birthday yesterday, today it is again January 1, 1900.

Comments

sinfield’s picture

I am experiencing what may be a variation on this problem. Rather than after some time has passed, my birthdays reset for any user when he or she creates content.

Drupal 5.1
PHP 5.1.6
mySQL 5.0.27

spyderpie’s picture

I am having the same trouble too!

yngens’s picture

sinfield, actually i have exactly the same problem as you do. i just could not figure out why and when exactly DB was changing. after reading your post i tried to set up BD and post new blog and, viola, BD changed back to January 1, 1900.

yngens’s picture

I recall this issue had been solved for 4.7, but now can not find the thread. Probably it was deleted. I wonder what BD module has with submitting new nodes?

hbrock’s picture

Hey there,
I'am having the same Problem on Drupal 5.1 PHP5.
I tried a little hack :
File : birthdays.module

function birthdays_user

changed from:
$year = $edit['DOB']['year'];
$month = $edit['DOB']['month'];
$day = $edit['DOB']['day'];

to:
$year = $edit['DOB']['year'];
$month = $edit['DOB']['month'];
$day = $edit['DOB']['day'];

if($year == null & $month == null & $day == null)
{
$year = $user->DOB['year'];
$month = $user->DOB['month'];
$day = $user->DOB['day'];
}

Maybe you can change the hole $edit stuff to $user but i didn't want to damage the original code.
Hope that helps ..

H-Brock

hbrock’s picture

Didn't do the trick for all users i will post my research results. But for now my Page is not resetting the Database DBO is still correct but the Date is not displayed the right way.

yngens’s picture

bkz of this error i had to switch the module off. will be waiting for the solution.

GTAce’s picture

I was just curious as to whether or not somebody has come up with a solution for this yet?

Dahaniel’s picture

I got the same problem.

mukeshtalks’s picture

Hello i am also facin same problem.

jacauc’s picture

Same here: http://www.dieinter.net/birthdays
subscribing

drazzig’s picture

I've tried to recreate this bug, and I managed to once, but not since. I've tried to add new content for different users to reset the birthday (using latest code release for Drupal v5) and also to run a cron job to see why people are reporting the birthday is resetting itself daily.

There is only one place where user's birthdays are updated in the database and thats on line 271:

$result = db_query("SELECT uid FROM {dob} WHERE uid = '%s' LIMIT 1", $user->uid);
if (db_num_rows($result) == 0) {
db_query("INSERT INTO {dob} (uid, birthday) VALUES ('%s', '%s-%s-%s');", $user->uid,$year,$month,$day);
} else {
db_query("UPDATE {dob} SET birthday = '%s-%s-%s' WHERE uid = '%s' LIMIT 1", $year,$month,$day,$user->uid);
}

There are no other places in the code where a DB insert or update are sent that could reset the data.

What I did to monitor this is place the watchdog statements below after each db_query to put in the log an entry everytime they are used. This will help to see if the code is getting to this point when content is created or cron jobs are being run:

watchdog('Birthdays', $user->name . ' UPDATE DOB', WATCHDOG_NOTICE, 'N/A');
watchdog('Birthdays', $user->name . ' INSERT DOB', WATCHDOG_NOTICE, 'N/A');

If you can add this to your modules and report the results this may bring us a little closer to finding what the problem is. Please report as much of the steps that led to the reset as possible so I can try and recreate locally and hopefully provide a fix!

Drazzig

drazzig’s picture

Actually a more useful watchdog statement would be:

watchdog('Birthdays', $user->name . ' UPDATE DOB' . $year . '-' . $month . '-'. $day, WATCHDOG_NOTICE, 'N/A');
watchdog('Birthdays', $user->name . ' UPDATE DOB' . $year . '-' . $month . '-'. $day, WATCHDOG_NOTICE, 'N/A');

So we can actually see whats being sent to the database. Thanks.

csc4’s picture

I noticed you're using the variable $dob a number of times and in different ways.

Line 267

     $year = $edit['DOB']['year'];
     $month = $edit['DOB']['month'];
     $day = $edit['DOB']['day'];

Line 314

 $dob = array('day' => $birthday->d,
    'month' => $birthday->m,
    'year' => $birthday->y);

Line 322

  $form[$cat]['DOB'] = array('#type' => 'date',
     '#title' => t('Date of birth'),
     '#default_value' => $dob,
     '#description' => t('Enter your date of birth'),
     '#required' => variable_get('birthdays_required', false));

Line 383

  $DOB = format_date(mktime(0,0,0,$birthday->m,$birthday->d,$birthday->y),'custom', variable_get('birthday_date_format','j F, Y'),$timezone);

Is it worth giving them distinct names for each sort of use to eliminate any possible conflicts from the puzzle? I think renaming the line 383 case would be a good idea.

maartenvg’s picture

Status: Active » Fixed

This seems to be fixed in the new development version. I happily can create and remove items without resetting birthday information.

Please confirm.

Anonymous’s picture

Status: Fixed » Closed (fixed)