function sms_user_save in SMS Framework 5
Same name and namespace in other branches
- 6.2 modules/sms_user/sms_user.module \sms_user_save()
- 6 modules/sms_user/sms_user.module \sms_user_save()
- 7 modules/sms_user/sms_user.module \sms_user_save()
1 call to sms_user_save()
- sms_user_user in modules/
sms_user/ sms_user.module
File
- modules/
sms_user/ sms_user.module, line 366 - Provides integration between the SMS Framework and Drupal users.
Code
function sms_user_save(&$edit, &$account, $category) {
if (($category == 'mobile' || $category == 'account') && $edit['sms_user'][0]['number']) {
foreach ($edit['sms_user'] as $delta => $number) {
if (is_numeric($delta)) {
$db_values = array(
$number['number'],
$number['status'],
isset($number['code']) ? $number['code'] : NULL,
serialize($number['gateway']),
);
if (isset($account->sms_user[$delta])) {
db_query("UPDATE {sms_user} SET number = '%s', status = %d, code = '%s', gateway = '%s'\n WHERE uid = %d AND delta = %d", array_merge($db_values, array(
$account->uid,
$delta,
)));
}
else {
db_query("INSERT INTO {sms_user} (number, status, code, gateway, uid, delta)\n VALUES ('%s', %d, '%s', '%s', %d, %d)", array_merge($db_values, array(
$account->uid,
$delta,
)));
}
}
}
$edit['sms_user'][0] = NULL;
}
}