In sms_sendtophone_page():

  if (user_access('send to any number') || !empty($user->sms_user['0']['number'])) {
    $form = drupal_get_form('sms_sendtophone_form', $type);
  }
  else {
    if (empty($user->sms_user['0']['number']) && user_access('send to any number')) {
      $register = array(
        '#value' => t('You need need to <a href="@setup">setup</a> your mobile phone to send messages.', array('@setup' => url('user/'. $user->uid .'/mobile')))
      );
    }
    else {
      $register = array(
        '#value' => t('You do not have permission to send messages. You may need to <a href="@signin">sign in</a> or <a href="@register">register</a> for an account to send messages to a mobile phone.', array('@signin' => url('user', array('query' => array('destination' => $_GET['destination']))), '@register' => url('user/register', array('query' => array('destination' => $_GET['destination']))))),
      );
    }
    $form = drupal_render($register);
  }

The following:

if (empty($user->sms_user['0']['number']) && user_access('send to any number')) {

will always evaluate to FALSE, as user_access('send to any number') cannot be TRUE at this point, because if it were TRUE, the code within the previous if-statement would have been run instead. The quoted line should be replaced with:

if (empty($user->sms_user['0']['number'])) {

which results in the expected behavior.

Comments

jpmckinney’s picture

Status: Active » Needs review
univate’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.