You are here

function sms_sendtophone_page in SMS Framework 7

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

Menu callback: displays the Send To Phone confirmation form for content.

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

File

modules/sms_sendtophone/sms_sendtophone.module, line 67
Provides various tools for sending bits of information via SMS.

Code

function sms_sendtophone_page($type = NULL) {
  global $user;
  $user = user_load($user->uid);
  if (user_access('send to any number') || !empty($user->sms_user) && !empty($user->sms_user['number']) && $user->sms_user['status'] == 2) {
    $form = drupal_get_form('sms_sendtophone_form', $type);
  }
  else {
    if ($user->uid > 0 && !empty($user->sms_user) && empty($user->sms_user['number'])) {
      $register = t('You need to <a href="@setup">setup</a> your mobile phone to send messages.', array(
        '@setup' => url('user/' . $user->uid . '/edit/mobile'),
      ));
    }
    elseif ($user->uid > 0 && !empty($user->sms_user) && $user->sms_user['status'] != 2) {
      $register = t('You need to <a href="@confirm">confirm</a> your mobile phone number to send messages.', array(
        '@confirm' => url('user/' . $user->uid . '/edit/mobile'),
      ));
    }
    else {
      $register = 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'],
          ),
        )),
      ));
    }
  }
  $output = !empty($form) ? drupal_render($form) : $register;
  return $output;
}