function sms_user_sms_incoming in SMS Framework 7
Same name and namespace in other branches
- 5 modules/sms_user/sms_user.module \sms_user_sms_incoming()
- 6.2 modules/sms_user/sms_user.module \sms_user_sms_incoming()
- 6 modules/sms_user/sms_user.module \sms_user_sms_incoming()
Implements hook_sms_incoming().
File
- modules/
sms_user/ sms_user.module, line 915 - Provides integration between the SMS Framework and Drupal users.
Code
function sms_user_sms_incoming($op, $number, $message, $options) {
switch ($op) {
case 'pre process':
if (variable_get('sms_user_switch_account_incoming', 0)) {
if ($account = sms_user_authenticate($number)) {
$metadata = array(
'login' => TRUE,
'number' => $number,
'message' => $message,
'options' => $options,
);
sms_user_login_metadata($account->uid, $metadata);
_sms_user_switch($account);
}
}
elseif (variable_get('sms_user_registration_enabled', 0) && $number) {
if ($account = sms_user_register_new_user($number, $message, $options)) {
// Send the new user the registration message if one exists.
if ($message = variable_get('sms_user_new_account_message', '')) {
sms_user_send($account->uid, $message);
}
}
}
break;
case 'post process':
if (variable_get('sms_user_switch_account_incoming', 0)) {
_sms_user_switch();
}
break;
}
}