3

I am using Linkedin module.

I want "Announce on LinkedIn" turned on by default. I am using Feeds module for RSS. It automatically created Feed and Feed Item Content types. RSS content is automatically saved as new node. But that node is not posted in Linkedin. I have to edit the content and manually check "Announce on LinkedIn" to have it posted:

Refer this Image

I want it posted automatically. How can I achieve that? Please anyone help to me. Thanks in advance

1

The issue here is the LinkedIn post functionality is tied to the node form; the form is altered to add the form component & submission hook. However, Feeds isn't using this form so it will never get a chance to process the submission handler.

If you look at the submission handler you can pull out the relevant function, linkedin_put_profile_field(), to make this happen. Combine this with hook_feeds_after_import(), and you can come up with an implementation that will trigger a LinkedIn post upon a feed import:

function MYMODULE_feeds_after_import(FeedsSource $source) {
  if(function_exists('linkedin_put_profile_field') && isset($source->feed_nid) && $node = node_load($source->feed_nid) {
    $status = variable_get('linkedin_default_format_'. $node->type, '');
    linkedin_put_profile_field($node->uid, 'current-status', $status);
  }
}

Note: there will probably need to be more checks & altercations here based on your needs (e.g. setting the right UID to post as, throttling posting so your feed importing doesn't get marked as spam on LinkedIn).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.