You are here

function sms_user_sms_receive in SMS Framework 5

File

modules/sms_user/sms_user.module, line 521
Provides integration between the SMS Framework and Drupal users.

Code

function sms_user_sms_receive(&$node, $sms_message) {

  // is $sms_message['from'] a general case?
  $number = $sms_message['from'];

  // how is this be handled with international numbers? do we need to remove +44 for UK?
  // should be able to test when we get Chinese SIM card
  if (substr($number, 0, 1) == '1') {

    // remove leading '1', sms_user doesn't store it...
    $number = substr($number, 1);
  }
  $uid = sms_user_get_uid($number);
  $account = user_load(array(
    'uid' => $uid,
  ));
  $node->uid = $account->uid;
  $node->name = $account->name;
}