function birthdays_save_user in Birthdays 6
Same name and namespace in other branches
- 5 birthdays.module \birthdays_save_user()
Inject information and save birthday when editing or adding a user.
1 call to birthdays_save_user()
- birthdays_user in ./
birthdays.module - Implementation of hook_user().
File
- ./
birthdays.module, line 667 - The Birthdays module allows users to add their birthday to their profile. It lists birthdays on a seperate page and in different blocks. Users can receive an e-mail on their birthday automatically, and the administrator can receive daily reminders of…
Code
function birthdays_save_user(&$edit, &$account, $category) {
global $_birthdays_field;
// Only continue when the field is present in the form results
if (!empty($_birthdays_field->name) && array_key_exists($_birthdays_field->name, $edit)) {
// Extract the date information
if (is_array($edit[$_birthdays_field->name])) {
extract($edit[$_birthdays_field->name]);
}
// Delete the old
db_query("DELETE FROM {dob} where uid = %d", $account->uid);
if ($day && $year && $month) {
// Set the starsign for the user.module to save in the {users}.data field
$edit['birthdays_starsign'] = _birthdays_get_starsign($day, $month);
// Insert the new
db_query("INSERT INTO {dob} (uid, birthday) VALUES (%d, '%d-%d-%d');", $account->uid, $year, $month, $day);
}
else {
$edit['birthdays_starsign'] = '';
unset($edit[$_birthdays_field->name]);
}
}
}