You are here

function twitter_account_form in Twitter 6.3

Same name and namespace in other branches
  1. 6.4 twitter.pages.inc \twitter_account_form()
  2. 7.3 twitter.pages.inc \twitter_account_form()
  3. 7.4 twitter.pages.inc \twitter_account_form()

Form to add a Twitter account

If OAuth is not enabled, a text field lets users to add their Twitter screen name. If it is, a submit button redirects to Twitter.com asking for authorisation.

1 string reference to 'twitter_account_form'
twitter_user_settings in ./twitter.pages.inc

File

./twitter.pages.inc, line 263

Code

function twitter_account_form($form_state, $account = NULL) {
  if (empty($account)) {
    global $user;
    $account = $user;
  }
  $form['uid'] = array(
    '#type' => 'value',
    '#value' => $account->uid,
  );
  if (_twitter_use_oauth()) {
    $form['#validate'] = array(
      'twitter_account_oauth_validate',
    );
  }
  else {
    $form['screen_name'] = array(
      '#type' => 'textfield',
      '#required' => TRUE,
      '#title' => t('Twitter user name'),
    );
    $form['import'] = array(
      '#type' => 'checkbox',
      '#title' => t('Import statuses from this account'),
      '#default_value' => TRUE,
      '#access' => FALSE,
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Add account'),
  );
  return $form;
}