howdy,
had twitter working fine on individual accounts. i decided to go with the sitewide account. i'm also using workflows so i setup an action and a trigger.
i also patched this 2.4 version because i was getting the WSOD.
everything is fixed. successfully posts to twitter.
the only problem is that it just prints the literal token - %title.
i tried it with !title !url which is in the default single user setup and that's no good either. whatever i put in the messagefield, what gets posted to twitter is literally what's in the field.
i've got the messagefield in actions set to plain text.
any ideas?
Comments
Comment #1
nathanmcginty commentedUPDATE -
Think it has something to do with my workflow settings. It passes the %site_name (whatever the actual code of that token is, don't have it right in front of me) so that it shows up in twitter as a url.
so i guess it's not getting the %url or %title from any of the actions. i moved the twitter post to last, but that didn't seem to make any difference.
here's the actions order:
MOVE POST TO NEW STATE
PUBLISH POST
PROMOTE POST TO FRONT PAGE
SAVE POST
SEND MESSAGE TO TWITTER
Thanks!
Comment #2
nathanmcginty commentedUPDATE, Part 2
Yeah, it's got to be something with the way Twitter is dealing with the tokens in Actions. I just sent a twitter message using all the variable it says are available in the Actions:
%site_name %username %node_url %node_type %title %teaser %body
What posted to Twitter was:
www.freedomhaters.org %node_url %node_type %title %teaser %body
%site_name was passed fine and showed up as a link. everything else was plain text. i guess it's not getting the variable from the node?
I added a "Send Tokenized Email" action right before the Twitter. That gets all the variable fine.
Comment #3
Sinan Erdem commentedI also have the same problem.
I am using Rules module, and even if I use %title, %node_url or anything apart from %site_name, it just prints as it is...
But where is "Send Tokenized Email" ? I cannot seem to find that action..
Comment #4
profjk commented**subscribing**
Comment #5
pyxio commentedI'm having the same problem using Rules triggers.
Comment #6
pyxio commentedIs there any help for this on the way? It seems like a rather significant bug, isn't it?
Comment #7
Sinan Erdem commentedComment #8
pyxio commentedIs this issue dead?
Comment #9
pyxio commentedSince this is apparently not going to be resolved anytime soon, is it something i can PAY to have done? The twitter automation with rules module is very important. Please let me know. Thank you. K
Comment #10
kmadel commentedBasically, for 'Workflow' the context of the action comes across as 'workflow' and there is not case in the context switch for this. I don't have time to role a patch right now, but basically in the context of workflow, the node object must be retrieved from the $context and is not the $object being passed into the action.
So basically, the context switch is defaulting and trying to use: $node = $object;
If you added (for workflow) the following switch case, it will work as a workflow action (twitter_actions.module):
case 'workflow':
// Because this is not an action of type 'node' the node
// will not be passed as $object, but it will still be available
// in $context.
//$node = $object;
$node = $context['node'];
watchdog('twitter_actions', "context hook is: !hook ", array('!hook' => $context['hook']));
watchdog('twitter_actions', "Node with !title, sent as twitter status.", array('!title' => $node->title));
break;
Comment #11
eaton commentedYou are, indeed, correct. The 'Post to twitter' action was originally intended as a general utility action, and doesn't have provisions for pulling a lot of context straight from a node. I'll be looking into it as I have time, but at least for the time being it isn't something that's being used by any of our clients/my sites/etc and it's hard to carve out the time for it.
Patches to twitter_actions readily accepted, though -- I haven't had time to dig in very deep.
Comment #12
mountaineer commentedCurious if there's anything new on this? I'm trying to unwind the use of Rules, Twitter, Twitter Action, Pathauto, Shorten, etc., etc.
I started out with a twitter action using a [node:url] token in the Twitter Action message field and in general, the [] style of tokens instead of the %token style that was suggested in the text below the field. Unfortunately, the [node:url] shortened the /node/number style rather than the aliased version from pathauto.
Which token style should we be using for Twitter actions? Only the %site_name worked out of the ones listed, so I'm not sure what the point of those is, why even have them if the [] style is there too?
Comment #13
jeni_dc commentedI was having some trouble with this, too, in trying to create an automatic post to twitter for a specific content type with a rule. I wanted to automatically post to twitter every time a certain node type was published using the format of: Node Title tinyurl. So if my post was called "This is a test post" the resulting tweet would read:
This is a test post http://tinyurl.com/xxxxxx
I looked into the twitter module to see how it was generating the tinyurls, then was able to get around this by using php code in the "Message" part of the rule like so:
Replace http://www.example.com/ in the above example with your url and it should work, complete with path alias, too!
DC
Comment #14
Michsk commentedyou should create a else which prints the url witouth tinyurl.
Comment #15
jeni_dc commentedYeah, that's certainly a good idea! So here's the updated code for that:
I did run into a MAJOR problem overall though with using that snippet. I was testing this using nodes that were to be submitted by anonymous users, and therefore unpublished by default. The admins were to then publish them after approval. So for that it was working great, but. . .
I then was testing similar functionality for the same site with nodes being created by administrators and being published straight away, and it seems that $node->path isn't available at that point so the URL in the resulting tweet was only http://www.example.com . So for now I've ended up using:
Sadly that won't return the SEO pathauto URLs, but at least it's getting people to the right place, especially with Global Redirect installed.
DC
Comment #16
nplus1 commentedunfortunately, this does not work for me. hence i used:
Comment #17
steinmb commentedPls. close if the old issue is fixed.
Comment #18
steinmb commentedDuplicate of #871728: twitter_actions token support missing