Apologies that I don't have time to dig into the code at the moment.

Steps to repeat problem:
1. On a blog post, turn off the "announce this post on twitter" check box
2. Click preview
3. On the preview page "announce this post on twitter" is now back on.

If the user doesn't notice that this got turned on again they could easily end up having their post announced via twitter when that was clearly not their intention.

Comments

sillygwailo’s picture

Version: 6.x-2.5 » 6.x-2.6

Verified in 2.6.

graker’s picture

Another issue for Preview: #633450: Status reset at node preview. Checkbox is not fixed though.

graker’s picture

Status: Active » Needs review
StatusFileSize
new551 bytes

I fixed 'twitter post' checkbox to save its state through node previews. The patch is attached.

skizzo’s picture

The patch does fix the problem on my system

hefox’s picture

Status: Needs review » Needs work

Probably fixes the issue, but I've never seen values in forms handled like that for preview (though it is 3:32 AM so my memory isn't as chirpy as that annoying bird outside is), so I suspect something else is at fault, perhaps the javascript?

Also, if the 3.x branch has this also, the code in question has been moved into a separate module (twitter_post)

graker’s picture

Hmm. Maybe I didn't understand you right, but actually it is a common way to handle #default_value in forms.

hefox’s picture

StatusFileSize
new1.42 KB

Aah... Looked around trying to find examples of that, but found this a pathauto one instead, http://drupal.org/files/issues/262464_pathauto_node_preview_11.patch . Instead of using form_values, they use that one in $node, so with that in mind re-patched. Same effect, but looking in $node seems more common.

hefox’s picture

StatusFileSize
new1.41 KB

oops copy and paste.

graker’s picture

Yeah, it's nearly the same thing. I just more used to use $form_state since this way I can handle default values for all forms, not only node edit ones.

phreestilr’s picture

Not sure why, but when I made the changes in #8, I started getting the message "Successfully posted to Twitter" when new accounts were created. I instead used the patch in #3, and it seems to be working fine

hefox’s picture

guessing ya using content_profile phreestili?

Ignore my patch in #8, shouldn't be done in prepare I realized soon after, should be done in form_alter; I think it'd be best to use a combination of a patch, where it checks if isset $node->twitter in the form_alter, as it's shorter, but shrug.

phreestilr’s picture

Yep, I am using content profile

skizzo’s picture

neither patch #3 nor #8 do apply cleanly to 6.x-3.0-beta3

steinmb’s picture

Status: Needs work » Closed (duplicate)