Hi there, I'm experiencing some problems since I have upgraded to the latest dev version, if I go to any user/xxxxx/edit page I got a Notice and a Warning messages:

    Notice: Undefined index: field en twitter_post_field_attach_form() (line 146 at .../sites/all/modules/twitter/twitter_post/twitter_post.field.inc).
    Warning: Invalid argument supplied for foreach() en twitter_post_field_attach_form() (line 146 at .../sites/all/modules/twitter/twitter_post/twitter_post.field.inc).

Then when I publish a content that should generate a tweet (that doesn't generates) I got this other messages:

Notice: Undefined index: es en twitter_post_entity_insert() (line 35 de .../sites/all/modules/twitter/twitter_post/twitter_post.module).
Warning: Invalid argument supplied for foreach() en twitter_post_entity_insert() (línea 35 at .../sites/all/modules/twitter/twitter_post/twitter_post.module).
Notice: unserialize(): Error at offset 0 of 1 bytes en UserController->attachLoad() (line 307 at .../modules/user/user.module).

Notice that at the last Notice message the path goes straight to "modules/" instead of "sites/all/modules/", I don't know if this have any implication, but anyway I call your attention on it.

I tried to uninstall the tweeter module I was just able to uninstall the "Twitter acctions" and "Twitter signin" submodules, but dealing with "Twitter post" one was impossible because even though I eliminate the twitter post field of the content I'm willing to tweet, the "Twitter post" submodule continues saying there was a field implicated.

Any way I tried again to unnistall the module and this time I succeded, why?... nfi. Well, I not only desable it but uninstall it also, then I reinstall it, but the behaviour is the same.

Any idea of what could be happening, I would appreaciate very much your help.

thanks

Comments

Cray Flatline’s picture

I have completely same problem. I have non-english website without internationalization. Such problem happens because a wrong language used in the fields. My node have language code 'ru', and twitter field has code 'und'.

I'm not a developer, so I can't create solution, but may be my investigation help somebody.

When I changed row 35 in the twitter_post.module to

foreach ($entity->{$field_name}[LANGUAGE_NONE] as $delta => $field_instance) {

and in the row 137 of the twitter_post.field.inc hardcoded $langcode = LANGUAGE_NONE;

module started post to twitter.

andrés chandía’s picture

Yes, I made the changed you suggested and posting on twitter was working again, eventhough the warnings at users edit pages remain.

The site with this problem is as yours not multilingual, only spanish, I have another multilingual site where this does not happens.

Thanks for sharing your fix.

symphonia’s picture

Thank you, this worked for me too. I have another question: how can I display tweets in a block? I've tried with views, but no tweets are displaying :(
can you help me please?

andrés chandía’s picture

1.- Create a block in your drupal

2.- Go to your twitter account > configuration > Widgets > Create New > Create widget.
At the box below will appear a code, copy it.

3. Paste the code in the body of your brand new block.

4. Save and enable the block.

and voilà, you have a block with tweets of your account.

enjoy it!!

symphonia’s picture

Thank you, but it doesn't work. The block displays just the code as I wrote it, despite I set the Full HTML ...
I'll try with twitter pull module to see if I can display tweets.

With Twitter module I can only post to twitter from my site, but I can't display any tweet, also on the view page /tweets provided with that module...don't know why, it's a bug for sure but I am not able to fix it...

andrés chandía’s picture

If you have any code editor (WYSIWYG) module like CKEditor or other you have to turn into plain text mode before pasting the code.....

symphonia’s picture

I've done it, but it didn't work...

andrés chandía’s picture

mine: http://parles.upf.edu/node/1011 (as an example)

symphonia’s picture

Finally I can display twitter posts: I installed the Twitter Pull module!! Works perfectly!

sergeypavlenko’s picture

Component: User interface » Twitter Post
Status: Active » Fixed
StatusFileSize
new3.15 KB

Fixed two bugs. Displays error on the page user/xxxxx/edit and error before publication.

sergeypavlenko’s picture

Status: Fixed » Needs review
StatusFileSize
new3.23 KB

Review patch

andrés chandía’s picture

I have updated to twitter-7.x-6.x-dev, it didn't post to tweetter
and it shows me these messeges:

Notice: Undefined index: es en twitter_post_entity_insert() (línea 35 de .../sites/all/modules/twitter/twitter_post/twitter_post.module).
Warning: Invalid argument supplied for foreach() en twitter_post_entity_insert() (línea 35 de .../sites/all/modules/twitter/twitter_post/twitter_post.module).

then I applied the patch:

twitter/twitter_post# patch < twitter_post-no_language_and_an_empty_array_of_fields-1953270-11.patch
(Stripping trailing CRs from patch.)
patching file twitter_post.field.inc
(Stripping trailing CRs from patch.)
patching file twitter_post.module
patch unexpectedly ends in middle of line
Hunk #1 succeeded at 32 with fuzz 1.

but it does not work, I get same messeges and it does not post to tweetter:

Notice: Undefined index: es en twitter_post_entity_insert() (línea 35 de .../sites/all/modules/twitter/twitter_post/twitter_post.module).
Warning: Invalid argument supplied for foreach() en twitter_post_entity_insert() (línea 35 de .../sites/all/modules/twitter/twitter_post/twitter_post.module).

Then I tried the changes proposed in comment #1 posted by CryAngel and I could post to twitter, and no messeges were shown.

maen’s picture

The same as http://drupal.org/node/1953270#comment-7342770 here. Although I can't take the solution because the entity fields crashed...

liquidcms’s picture

StatusFileSize
new558 bytes

similar error on forms which do not have standard fields (and do not need to post to twitter):

Warning: Invalid argument supplied for foreach() in twitter_post_field_attach_form() (line 146 of /home/admin/public_html/calpoly/sites/all/modules/twitter/twitter_post/twitter_post.field.inc).

attached patch fixes the error

liquidcms’s picture

Issue summary: View changes

Adding some more information

symphonia’s picture

Hello! I've just installed the dev version 2 of twitter module. No error shown but no tweets! I have same module installed on other sites but here it just doesn't works! Anyone can help please? thanks

damienmckenna’s picture

Status: Needs review » Needs work

Triggering the testbot.

damienmckenna’s picture

Status: Needs work » Needs review

Triggering the testbot.

jessehs’s picture

StatusFileSize
new953 bytes

This patch also checks to see if the $form_state['field'] isset().

The last submitted patch, 14: twitter_post.field_.inc_.patch, failed testing.

damienmckenna’s picture

damienmckenna’s picture

damienmckenna’s picture

Status: Needs review » Needs work

It should also be using field_get_items() to load the correct language value, not hardcoding it.

damienmckenna’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.