function twitter_non_auth_account_form_submit in Twitter 7.6
Same name and namespace in other branches
- 6.5 twitter.pages.inc \twitter_non_auth_account_form_submit()
- 7.5 twitter.pages.inc \twitter_non_auth_account_form_submit()
Submit form handler to add a non-authenticated Twitter account.
File
- ./
twitter.pages.inc, line 591 - Page callbacks for Twitter module.
Code
function twitter_non_auth_account_form_submit($form, &$form_state) {
$name = $form_state['values']['screen_name'];
$twitter = twitter_connect(NULL, TRUE, TRUE);
if (empty($twitter)) {
return FALSE;
}
$twitter_account = $twitter
->users_show($name, FALSE);
if (!isset($twitter_account->twitter_uid)) {
form_set_error('screen_name', t('Could not add the Twitter account <em>@name</em>. ' . 'Check the recent messages log.', array(
'@name' => $name,
)));
}
else {
$twitter_account->uid = $form_state['values']['uid'];
twitter_account_save($twitter_account);
drupal_set_message(t('Non authenticated Twitter account added successfully'));
}
}