Enabling the trigger/action combo for new and updated posts causes unpublished nodes to be posted to Twitter automatically. The attached patch remedies this in a quick and dirty way, but hopefully it will give some ideas for future updates.

Ideally, I'd like to be able to restrict the auto-tweet trigger to published nodes of type story only via the admin interface.

Comments

alastair’s picture

Actually, that patch doesn't fix the issue. :-S I'll try and put together another.

jbrauer’s picture

Status: Needs review » Needs work

Updating status to reflect comment #1

eyecon-1’s picture

Subscribe

Leeteq’s picture

Subscribing.

mandclu’s picture

Subscribing

podarok’s picture

using scheduler module twitter do not twit!
subscribing

ArthurC’s picture

@alastair: in comment #1 you said your patch doesn't work and that you'd try to put together another. Were you successful?

I didn't twig to the importance of tweeting only published nodes until I saw the first unpublished one tweeted. Yikes!

alastair’s picture

@ArthurC I'm afraid not; it got shuffled down my to-do list somewhat. I'll see if I can get something done in the next couple of days.

ArthurC’s picture

@alastair: That would be wonderful. I'll check back regularly. Thanks.

ArthurC’s picture

As I spend more time with the Twitter module, I think I understand better how it works. Others reading this may already understand, but perhaps this will be helpful for a few.

I've been using the action/trigger automatic tweets for new nodes. Something I noticed is that the url in the tweet is "...node/nn" instead of the url that the pathauto module generates. Wondering why that might be, I'm thinking that the pathauto code probably hasn't even had a chance to do its magic before the twitter module kicks into action. Maybe the node itself isn't completely resolved. Maybe it's not even possible to check $node->status at this stage?

So I turned off the action/trigger method, and am using the manual method, whereby you check whether to tweet or not when editing the node. Lo and behold! It knows published from unpublished and won't tweet for unpublished nodes no matter how hard you click the "Announce this post on Twitter" check box. (This may be where twitter_nodeapi() in twitter.module gets to play.)

I'd like the automatic action/trigger to work, but the manual method does afford a greater degree of user control over when to post the node to Twitter.

@alastair: please don't make any urgent efforts on my behalf, but if you do get it working, I'll be watching for it.

Thanks.

alastair’s picture

@ArthurC: I think you're right. I spent a fairly frustrating time (compounded by some recent computer problems) getting nowhere with this. To get this to work correctly, I think Drupal core would need the capability to configure the order in which triggers fire, and perhaps precisely when (i.e., before post save, after post save, etc.) too.

However, I've found that the manual method also posts unpublished nodes in my deployment. I'll double-check what version I'm using of the module when my computer's back up and post a separate bug report if needs be.

This bug report could probably be legitimately closed as "won't fix" or "by design".

juampynr’s picture

Status: Needs work » Closed (won't fix)

As you command in the latest comment.

Leeteq’s picture

Has this been a known problem also in the D7 branch?

juampynr’s picture

Assigned: Unassigned » juampynr
Status: Closed (won't fix) » Active

DanielTheViking: I have not checked, but the D7 branch is in a pretty similar state as the D6 branch (6.x-3.x), so believe so.

To be honest I do not understand what is really happening. Could anyone provide steps to reproduce the issue? that would help me understand and evaluate if a fix is needed now or not.

Leeteq’s picture

Version: 6.x-2.0 » 7.x-3.x-dev
Status: Active » Postponed (maintainer needs more info)

Would be nice if someone that is experiencing this with the 7.x branch would chime in and confirm here.

tuwebo’s picture

Hi,
I have just tested the manual posting method in D7. What I did:
1 - Create an Article and check the "Announce this post on Twitter"
2 - Before saving, I unchecked both, Published and Promoted to front page, so the node will be saved but not published.
3 - Run cron, and go to twitter account. Nothing was posted to twitter-> OK

Then I did next steps (manual method):
1 - Create an Article and check the "Announce this post on Twitter"
2 - Before saving, I checked "Published", so the node will be saved and published.
3 - Run cron and went to my twitter account: It was posted to twitter-> OK

So it looks like the manual method works fine in D7 latest branch.

tuwebo’s picture

Hi,
To see the behavior in D7 for automatic posts, we need to have a stable twitter_actions.module, wich we can follow in this #1317196: Implement Actions and Rules integration for Drupal 7

tuwebo’s picture

Using this patch #1317196-2: Implement Actions and Rules integration for Drupal 7, I can set an action (Post message to twitter).
When I am saving a node (even if it is unpublished) the message will be sent, but I think this is the right behaviour, since there is no condition attached to the action.

steinmb’s picture

Regarding the tests in #16, did you also test with the default setting set to "post to twitter" ?

tuwebo’s picture

Hi steinmb,
Yes I did, it will always be posted in that case, no matter if the node is published or unpublished.
There is an issue which is implementing some rules #1317196: Implement Actions and Rules integration for Drupal 7, maybe (I don´t know if it is possible) it would be helpful to add a condition to the rules, something like "Node is published", and then use that rule for "posting to twitter" instead.
What do you think about it?

steinmb’s picture

Status: Postponed (maintainer needs more info) » Active

OK, I was afraid that would happen, changing status. I know a lot of sites are not using rules, and I think rules is a bit heavy just for this, I find this to be unexpected behavior and we have to fix it within the module. Don't get me wrong, the idea of having a "node is published" condition that rules is great, and we need that to.

tuwebo’s picture

Category: bug » feature
Status: Active » Needs review
StatusFileSize
new3.89 KB

Hi,
I have added a patch.
Now the user have the option to choose to send the message even if the content (node) was unpublished.
I think this is a feature request, since the module was working as spected.
If nobody minds, I will change the status to Featured request and needs review.

Please test it, since I didn´t have much time for it.

You can go to admin/config/system/actions, and select configure from "Post a message to Twitter".
There should be a new checkbox asking for posting messages even if the content is not published.

Comments and reviews are very welcome.
Notice that this will only works for actions on comment and node triggers.

We also need to ask the mantainer if this is the right behaviour for this module...

widhalmt’s picture

subsribe

tuwebo’s picture

Does anyone tested the patch?
widhalmt if you did it, please report.

davidneedham’s picture

Can you re-roll to 7.x-5.x?

13rac1’s picture

Version: 7.x-3.x-dev » 7.x-5.x-dev

Patch applies with fuzz/offset to 7.x-5.x, but needs reroll. Needs further testing.

 patch -p1 < add_configuration_for_unpublished_content-382850-22.patch 
patching file twitter_actions/twitter_actions.module
Hunk #1 succeeded at 69 (offset -3 lines).
Hunk #2 succeeded at 109 (offset 2 lines).
Hunk #3 succeeded at 126 (offset 2 lines).
Hunk #4 succeeded at 143 (offset 2 lines).
Hunk #5 succeeded at 146 (offset -14 lines).
Hunk #6 succeeded at 189 with fuzz 1 (offset 2 lines).

Misspelling:
+ if($post_unpublised_content)

damienmckenna’s picture

Issue summary: View changes
Status: Needs review » Needs work

Triggering the testbot.

damienmckenna’s picture

Status: Needs work » Needs review

Triggering the testbot.

damienmckenna’s picture

Assigned: juampynr » Unassigned
steinmb’s picture

Assigned: Unassigned » steinmb
Status: Needs review » Needs work

Patch no longer apply to HEAD. I'll try to manually fix it.

The last submitted patch, 22: add_configuration_for_unpublished_content-382850-22.patch, failed testing.

damienmckenna’s picture

Status: Needs work » Needs review
damienmckenna’s picture

Status: Needs review » Closed (duplicate)