function sms_user_user in SMS Framework 6
Same name and namespace in other branches
- 5 modules/sms_user/sms_user.module \sms_user_user()
- 6.2 modules/sms_user/sms_user.module \sms_user_user()
Implmentation of hook_user().
File
- modules/
sms_user/ sms_user.module, line 299 - Provides integration between the SMS Framework and Drupal users.
Code
function sms_user_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
case 'load':
return sms_user_load($edit, $account, $category);
case 'update':
case 'insert':
return sms_user_save($edit, $account, $category);
case 'register':
return sms_user_register();
case 'delete':
return sms_user_delete($account->uid);
case 'validate':
if (!empty($edit['sms_user']) && (variable_get('sms_user_registration_form', 0) == 2 || strlen($edit['sms_user'][0]['number']))) {
if ($error = sms_user_validate_number($edit['sms_user'][0]['number'])) {
form_set_error('sms_user][0][number', $error);
}
}
break;
case 'login':
// Check if first it's the user's first time logging in.
if (!$account->access && $account->sms_user[0]['number']) {
sms_user_send_confirmation($account, $account->sms_user[0]['number'], $account->sms_user[0]['gateway']);
drupal_set_message(t('A confirmation message has been sent to your mobile phone. Please !link.', array(
'!link' => l(t('confirm your number'), 'user/' . $account->uid . '/mobile'),
)), 'status');
}
break;
}
}