You are here

function twitter_non_auth_account_form in Twitter 7.5

Same name and namespace in other branches
  1. 6.5 twitter.pages.inc \twitter_non_auth_account_form()
  2. 7.6 twitter.pages.inc \twitter_non_auth_account_form()

Form to add a non-authenticated Twitter account.

1 string reference to 'twitter_non_auth_account_form'
twitter_user_settings in ./twitter.pages.inc
Form builder that lists Twitter accounts.

File

./twitter.pages.inc, line 532
Page callbacks for Twitter module.

Code

function twitter_non_auth_account_form($form, $form_state) {
  $form['screen_name'] = array(
    '#type' => 'textfield',
    '#required' => TRUE,
    '#title' => t('Twitter account name'),
    '#prefix' => t('If you simply want to pull tweets from additional Twitter accounts, enter the Twitter account name below and click on the following button.'),
  );

  // Track the user's ID. If this is the global Twitter accounts form, use the
  // current user's uid, it should be the accounts form for a specific user, so
  // try using that user's account.
  global $user;
  $uid = $user->uid;
  if (arg(0) == 'user' && arg(1) != '' && arg(2) == 'edit' && arg(3) == 'twitter') {
    $arg1 = arg(1);
    if (is_numeric($arg1)) {
      $uid = intval($arg1);
    }
  }
  $form['uid'] = array(
    '#type' => 'value',
    '#value' => $uid,
  );
  $form['submit_non_auth'] = array(
    '#type' => 'submit',
    '#value' => t('Add a non-authenticated account'),
  );
  return $form;
}