When adding a new twitter account that is not protected the saved account always have the private (protected) option set.

The patch from #509034: Protected Accounts Are Not Marked Protected already committed on July 4, 2009 doesn't solve that problem completely.

The twitter_fetch_account_info() function gathers information from Twitter and returns the xml data converted into an array.

But there are cases where the value should be a boolean. (http://twitterapi.pbworks.com/Return-Values)
That is the definition for
protected
Description: boolean indicating if a user has a protected profile
Examples: true, false

The issue is that the $results array returned for this is:
protected (String, 5 characters ) false

but in twitter_add_account_submit() the testing is wrong (twitter.pages.inc)

      $account = twitter_fetch_account_info($form_state['values']['screen_name'], $form_state['values']['password']);
      if ($account['protected']) {
        $form_state['values']['protected'] = TRUE;
      }

It always returns the account information as protected. In others parts of the module assumes that protected is a boolean, creating side problems.

I have added a clean up function for the booleans values to convert them into a boolean instead a string but this is done in the xml conversion to array functions.

Other problem when you are adding a new account is that the input validation is wrong, first we need to check for a mandatory screen_name and later for a correct optional password.
And submit this values to the twitter_user_save() function.

CommentFileSizeAuthor
twitter_protected_accounts.patch2.92 KBjcmarco

Comments

steinmb’s picture

Version: 6.x-2.x-dev » 6.x-3.x-dev
Status: Needs review » Needs work

Is related to #509034: Protected Accounts Are Not Marked Protected and we need to reroll

davidneedham’s picture

Status: Needs work » Closed (cannot reproduce)

No reply.