You are here

function sms_sendtophone_page in SMS Framework 5

Same name and namespace in other branches
  1. 6.2 modules/sms_sendtophone/sms_sendtophone.module \sms_sendtophone_page()
  2. 6 modules/sms_sendtophone/sms_sendtophone.module \sms_sendtophone_page()
  3. 7 modules/sms_sendtophone/sms_sendtophone.module \sms_sendtophone_page()

Menu callback.

1 string reference to 'sms_sendtophone_page'
sms_sendtophone_menu in modules/sms_sendtophone/sms_sendtophone.module
Implementation of hook_menu().

File

modules/sms_sendtophone/sms_sendtophone.module, line 74

Code

function sms_sendtophone_page($type = NULL) {
  global $user;
  $user = user_load(array(
    'uid' => $user->uid,
  ));
  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', 'destination=' . $_GET['destination']),
          '@register' => url('user/register', 'destination=' . $_GET['destination']),
        )),
      );
    }
    $form = drupal_render($register);
  }
  if (isset($_GET['thickbox'])) {
    print $form;
    exit;
  }
  return $form;
}