Distributor: Automated runs would be a big help

Created on 28 Feb 2018  ·  7Comments  ·  Source: 10up/distributor

Being able to trigger a syndication for a subset of posts via a cron would be very helpful. The option of a time of day schedule or a recurring elapsed time would be ideal.

The interface should allow a query to be built using any combination of post data, taxonomies or metadata plus options like search, since, record limit, image limit, run time limit (to avoid timeouts), and rate limiting. Users, capabilities and roles would be great also.

A helper function would also be needed to restart the cron until it completes or fails. Obviously it would also need to store the URL of the site to push to or pull from. Custom post types should also be supported.

Maybe this should be a separate add-on plugin? Are there currently sufficient hooks to make that possible?

Reporter Feedback enhancement

Most helpful comment

Am I correct to use that Class? And is the WP_Site in the constructor the target site? Looking at the coding it does looks like it right?

@jmslbam Yes, you're right, you can use that class to distribute posts to sites in the network. Take a look at the following function for more inspiration on how to distribute posts programmatically.

https://github.com/10up/distributor/blob/faadb682cc1d1bc9037c445a46d86aa7949e6109/includes/push-ui.php#L224-L374

All 7 comments

@dleeward thanks for the input, interesting idea. What's the use case you're looking to solve for with this idea?

@dleeward whats the problem you're trying to solve with this cron-based solution?

@dleeward can you please provide some more insight into the problem you're trying to solve here?

I'm closing this issue due to inactivity, but please let me know if you're still having problems so I can try to help... thanks!

Hi @jeffpaul,

Before creating a new ticket, is it ok to jump in here because I have the same request which I need for my current project.
I'm importing events which need to be distributed to a subsite based on a taxonomy term. Noting more, nothing less.

As this is my first run with Distributer, I would like to double check my current view of the plugin / steps I will take.

  1. I map my subsite to a specific term.
  2. Loop over all posts with Term X.
  3. Push these posts to the subsite using class NetworkSiteConnection extends Connection

Am I correct to use that Class? And is the WP_Site in the constructor the target site? Looking at the coding it does looks like it right? https://github.com/10up/distributor/blob/develop/includes/classes/InternalConnections/NetworkSiteConnection.php#L53

And then I'm not taking in account the whole configuration / setting up the network and allowing site A to push to site B. Defining that in code, would be great and maybe it can already be done, but I think that is out-of-scope of this issue.

Kinds regards,

Jaime Martinez

Am I correct to use that Class? And is the WP_Site in the constructor the target site? Looking at the coding it does looks like it right?

@jmslbam Yes, you're right, you can use that class to distribute posts to sites in the network. Take a look at the following function for more inspiration on how to distribute posts programmatically.

https://github.com/10up/distributor/blob/faadb682cc1d1bc9037c445a46d86aa7949e6109/includes/push-ui.php#L224-L374

Thank you @dinhtungdu for the feedback, will proceed with those example. If I find some optimalisations to decouple some code I will drop it here! Will keep you posted!

Was this page helpful?
0 / 5 - 0 ratings