Hi
Thanks for the reply I received however I am unsure of what to ask for. Maybe if you read through how my own plugins work you could suggest some sort of request I could put to the Jetpack team as I am sure they won’t accommodate my own hooks/actions in their plugin.
The email I got is below.
Hi Rob!
> Therefore I am thinking your plugin and others like it are doing calls on the
> publish_post hook and this is causing no tagging to be done or tweets to go out
> even if your social media posts go out.
Here’s what I suggest: have a look at the Publicize code (at least, what’s in the plugin, since a lot of Publicize happens on the WordPress.com side of things).
https://github.com/Automattic/jetpack/blob/master/modules/publicize/publicize.php#L68
We hook into the transition_post_status hook; when a post goes from draft or unsaved to Published, that’s when we start saving the related Post-meta as you mentioned.
If you don’t find an adequate place in the plugin that you can hook into for what you’re doing with your own plugins, then please open up an enhancement request here:
https://github.com/Automattic/jetpack/issues/new
and specify that you’d like a hook added to the plugin, and where exactly.
Does that help?
So I know 100% turning the Publicize code off fixes the problem I was having with emails being turned into posts (with the Postie plugin) and then social media going out and my posts getting tagged with Strictly AutoTags and then Tweeted with Strictly TweetBOT.
What I don’t know is how to re-arrange the way my two plugins interact as they rely on custom hooks/actions. If I need to ask for a new feature in Jetpack I need some help in figuring out what I need to ask for.
I have an Auto Tagger Plugin (Strictly AutoTags) that the save_post action fires (draft/publish) to tag the post.
After the tagging is complete I need Jetpacks Publicize event to fire sending out the messages to Google+, Tumblr, LinkedIn etc.
Due to the high number of tags I have on my site 25,000+ just changing the priority order doesn’t work to ensure tweets or other messages are sent out AFTER the tagging is done.
On small sites it might.
However I have to re-save the newly tagged and reformatted post back into the DB before calling my other plugin Strictly TweetBOT (that fires tweets using tags as #hashtags to numerous accounts).
So what happens is that after the post is first saved and on_save runs
-I re-open the post and do the tagging before re-saving it using SQL only.
-I set a finished_doing_tagging action/event with the post_id so other plugins can run off it e.g my TweetBot. It would be nice if I could get Jetpack to also hook into this action to fire off its messages to LinkedIn/Tumblr/Google+ etc.
// fire my custom event so any plugin wanting to run when tagging is completed can now do so pass in the post ID as the parameter so others can use it
do_action('finished_doing_tagging', $object->ID);
-Then my Strictly TweetBOT plugin uses the publish_post action to call a function CheckAndPostTweets which checks for the existence of AutoTags to decide whether to wait for the end of tagging or to run ASAP.
add_action( 'publish_post', array($this, 'CheckAndPostTweets') , 999);
This function works out whether AutoTags is installed.
If not it just runs and sends the tweets.
If it is installed then it adds our PostTweets function to the finished_doing_tagging hook/event.
if($strictly_auto_tags_active ){
// AutoTags is active - have we tweeted already?
$tweeted_already = get_post_meta($post_id, 'strictlytweetbot_posted_tweet', true);
if(!$tweeted_already){
// Strictly AutoTags is loaded so wait until the finished_doing_tagging event fires for $post_id
// hook post_tweets into our finished_doing_tagging HOOK/EVENT
add_action('finished_doing_tagging',array($this, 'PostTweets'),99,1);
}else{
// Strictly AutoTags is loaded but we have already tweeted! so RETURN FALSE!
return;
}
}else{
// no Strictly AutoTags and no tags/categories so just post tweets now for $post_id
// just run normal tweet code
$this->PostTweets($post_id);
}
Once Tweeting is complete I set some post meta to tell me that this post has had the tweetbot code run against it. Which you can see being used in the above code snippet to determine whether Tweeting has already run for this post.
// after tweeting we set the event strictlytweetbot_posted_tweet so we know we have posted tweets for this post id
add_post_meta($post_id, 'strictlytweetbot_posted_tweet', '1', true);
So somewhere I need to ask JetPack to get their Publicize code to run on the same hook I have e.g finished_doing_tagging.
Or (as I doubt they will change their code to fit in with MY plugins) arrange the order of events in such a way that I can fire their publicize function once my tagging is complete.
As for why their Publicize action is effecting the change of Posties posts from temporary posts to real ones I have no idea unless it’s my tagging plugin effecting it in someway.
If you have any ideas I would love to hear them.
Thanks!