I would like to thanks to the creator of this module for this incredible work.
I have observed some things that with which you can make twitter more better.
1) Nodes that are not published should not be posted to twitter. There may be approval process for nodes to get publish right?
2)Twitter passwords are not being encrypted which is not good. There should be someway to encrypt it while saving in db and when posting to twitter it should get decrypted.

Comments

pribeh’s picture

in response to #1:

Ya, you could accomplish this with rules but the problem I find with using rules is that I can't find a %url replacement so that tinyurls are used to link back the "published" content from twitter.

rightchoice2c_me’s picture

My requirement was that nodes should not get published as they are created, there is an approval process, once the content is approved then it should set the status in twitter. But twitter module set the status in twitter.com once the content is created.
As I am using workflow module for approval process. I set the action is workflow Post to twitter when content is published.
I did that by just adding a workflow in context in this hook twitter_actions_set_status_action in twitter_actions.module file.

global $user;
  $variables['%site_name'] = variable_get('site_name', 'Drupal');

  switch ($context['hook']) {
    case 'nodeapi':
      // 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 = $context['node'];
      break;
      case 'workflow':
      // Some times the node publish will be assosiated with worklows
      // so once the node is published through workflow the status should then be send to twitter
      $node = $context['node'];
      break;
    // The comment hook provides nid, in $context.
    case 'comment':
      $comment = $context['comment'];
      $node = node_load($comment->nid);
    case 'user':
      // Because this is not an action of type 'user' the user
      // object is not passed as $object, but it will still be available
      // in $context.
      $account = $context['account'];
      if (isset($context['node'])) {
        $node = $context['node'];
      }
      elseif ($context['recipient'] == '%author') {
        // If we don't have a node, we don't have a node author.
        watchdog('error', 'Cannot use %author token in this context.');
        return;
      }
      break;
    case 'taxonomy':
      $account = $user;
      $vocabulary = taxonomy_vocabulary_load($object->vid);
      $variables = array_merge($variables, array(
        '%term_name' => $object->name,
        '%term_description' => $object->description,
        '%term_id' => $object->tid,
        '%vocabulary_name' => $vocabulary->name,
        '%vocabulary_description' => $vocabulary->description,
        '%vocabulary_id' => $vocabulary->vid,
        )
      );
      break;
    default:
      // We are being called directly.
      $node = $object;
  }


summit’s picture

subscribing, greetings, Martijn

eaton’s picture

Twitter module should not post to twitter when a node is unpublished. if (!empty($node->status))... in Twitter's hook will bail out if the node's status is not 'published'. Is it possible that the nodes ARE published by default, but their status is being changed to 'unpublished 'by actions or some other mechanism?

rightchoice2c_me’s picture

try workflow module.

aeneas07’s picture

@eaton they shouldn't be but they are...

I tried the workflow module but the variables for the twitter module weren't working, it would just say %title instead of the actual title.

a sort of fix is to put the twitter action on the when node is updated trigger and not the saved one. It isn't perfect but it works

pembertona’s picture

I think some of the confusion here is in the module's handling of nodes that aren't published by default.

As of version 2, if a given node isn't set to be 'published' when initially created, checking the 'post to twitter' box gets wiped out when saving the form. Only after the post is published does the checkbox make any sense.

I added a check to twitter_form_alter to prevent displaying the twitter form on unpublished posts:

//Because tweets can only be added for published posts, don't display form for unpublished

if(empty($form['#node']->status)){
	return;	
}
moguls’s picture

Version: 6.x-2.x-dev » 6.x-2.6

I am running 6.x-2.6 and having this problem. I have a CCK content type I am creating and testing. It defaults to unpublished. The content type is NOT checked to post to Twitter on the Twitter Setup admin page, yet when I edit the node, it gets posted to Twitter. It should not as it is not published and set up to not be posted to Twitter.

Thanks.

steinmb’s picture

Version: 6.x-2.6 » 6.x-3.x-dev
Priority: Critical » Normal

Not critical, but we should perhaps retest (and write an test) with the latest versions to make sure that unpublished nodes are not updating the twitter feed.

dddave’s picture

Version: 6.x-3.x-dev » 6.x-5.x-dev
damienmckenna’s picture

Issue summary: View changes
Status: Active » Closed (duplicate)