Giter Club home page Giter Club logo

distributor's Introduction

Distributor icon

Distributor

Distributor is a WordPress plugin that makes it easy to distribute and reuse content across your websites — whether in a single multisite or across the web.

Support Level Tests Linting Code scanning Release Version WordPress tested up to version License

You can learn more about Distributor's features at DistributorPlugin.com and documentation at the Distributor documentation site.

Note: The latest stable version of the plugin is the stable branch. Download the stable branch if you are intending to use the plugin in a Production environment.

Table of Contents

Features

Distributor supports safe, SEO-friendly content reuse and sharing via "pushing" and "pulling".

While logged in and editing or viewing any single post (or custom post type) that can be distributed, a Distributor admin bar item will appear, that will facilitate sharing ("pushing") that content to any connection.

Push the content you’re editing or viewing to any of your other sites from the admin bar

In the admin dashboard, a top level Distributor menu item links to the "pull" screen. Here, editors can share ("pull") content from any connection into the current site.

Pull content from another site from the Distributor admin menu

Content this is distributed (via Push or Pull) is connected to the original. Reposted content receives updates from the original, canonical source automatically.

Distributor intuitively presents the origin and status of any reused content

There are two connection types: internal and external.

  • Internal connections are other sites inside of the same multisite network. Any user logged into the network can distribute any content in the network to any other sites in the network where that user has permission to publish posts (assuming the site supports the same post type).
  • External connections are external websites, connected by the JSON REST API using the Authorization Setup Wizard for External Connections leveraging Application Passwords. External connections can be added in the WordPress admin dashboard under Distributor > External Connections. Administrators can decide which user roles are allowed to distribute content to and from that connection (Editors and Administrators by default). All users with those roles will inherit the permissions of the user account used to establish the remote connection.

Extendability

Distributor is built with the same extensible approach as WordPress itself, with fully documented hooks and filters to customize its default behavior and create custom distribution workflows. You can even create connections to other platforms.

Requirements

  • PHP 7.4+
  • WordPress 5.7+
  • External connections require HTTP Basic Authentication or WordPress.com OAuth2 (must be on WordPress VIP) be set up on the remote website. For Basic Auth, we recommend using Application Passwords built in to WordPress.
  • For external connections, Distributor needs to be installed on BOTH sides of the connection.
  • Version 2.0.0 of Distributor requires version 2.0.0 on BOTH sides of all connections. For other version 2.0.0 specific changes, please see our migration guide.

Installation

For Production use, we recommend registering and downloading the plugin from DistributorPlugin.com – it's 100% free. You will be emailed a direct link to download the latest, production-ready build. Alternatively, you can download the latest release from GitHub.

You can upload and install the archived (zip) plugin via the WordPress dashboard (Plugins > Add New -> Upload Plugin) or manually inside of the wp-content/plugins directory, and activate on the Plugins dashboard.

Registration

To help inform our roadmap, keep adopters apprised of major updates and changes that could impact their websites, and solicit opportunities for beta testing and feedback, we’re asking for a little bit of information in exchange for a free key that unlocks update notifications and 1-click upgrades inside the WordPress dashboard. Your information is kept confidential. You can register here and input your key in Distributor settings in the dashboard (network dashboard for multisite users). Note that you need to input the email address you used to register Distributor (included in the email with your registration key) as that is linked to the registration key.

Set up External Connections

  1. Ensure that the current version of Distributor is active on BOTH sites being connected. We'll refer to these as mainsite.com and remotesite.com.
  2. On mainsite.com, navigate to Distributor > External Connections and click Add New.
  3. Enter a label for the connection (e.g., remotesite).
  4. Enter the URL (e.g. https://remotesite.com) for your remote site below the External Site URL and press the Authorize Connection button.
  5. You will be prompted to enter the user name and password of an administrative role of the remotesite.com if you are not already logged into remotesite.com and then redirected to the Authorize Application screen.
  6. At the Authorize Application screen, enter the name of the main site and press the 'Yes, I approve of this connection' button
  7. Review the roles selected in Roles Allowed to Push are the ones you want to support, update if necessary, then press the Update Connection button.

How to Distribute Content

There are two methods for distributing content between multiple WordPress sites, Push and Pull. Pushing allows you to share content from your site to one or more connected sites while Pulling allows you to bring content into your site from one of your connected sites. In either method, once content has been distributed it will stay in sync with any changes made to the origin post (when Pushing the origin is the site being Pushed from, when Pulling the origin is the site being Pulled from).

Pushing Content

The Distributor menu in the WP Admin Bar will appear after a piece of content has been published. Hovering over that menu item will expose the Push menu that displays the list of connected sites on the left, the list of sites that have been selected for push distribution on the right, and a button to Distribute the content to those selected sites.

Push menu exposed when viewing published content on the front-end

The same Push menu and set of Distributor options are also available after publishing a piece of content within the WordPress Block Editor.

Push menu exposed when viewing published content in the Block Editor

After you click the Distribute button, Distributor will push the content to the selected connected sites, showing a View link when those pieces of content have been distributed, and noting Post successfully distributed. once the content has completed distributing to selected sites.

Push menu showing details after content distribution

When viewing that piece of content in the Block Editor, there will be a Distributor notice in the Status & visibility section noting how many sites the content has been distributed to.

Block Editor sidebar showing Distributor count of sites that content has been distributed to (via Push and Pull)

The same Push menu is available in the WP Admin Bar if you are using the Classic Editor. The Distributor notice is also available in the Publish metabox noting how many sites the content has been distributed to.

Classic Editor showing the Push menu and metabox showing Distributor count of sites that content has been distributed to (via Push and Pull)

Pulling Content

Navigating to the Distributor > Pull Content screen in the WP Admin will present you with a dropdown to select any of the sites you are connected to and will display all available pieces of content that can be Pulled into the current site. You can select Posts, Pages, and other Custom Post Types to filter on this screen; you can use the Bulk Edit menu to Pull or Skip more than one piece of content at a time; and you can use individual row actions on each piece of content pull, view, or skip each piece of content.

Pull Content screen showing row actions and a single post selected for Pulling

After you have Bulk Pulled several pieces of content or used the row actions to Pull a single piece of content, the Pull Content screen will show a confirmation message that the Pull action was successful and redirect you to the Pulled list view to see all the items that have been pulled into the current site. The same process will happen if you opt to Skip specific piece(s) of content.

Pull Content screen showing confirmation on content being pulled

You can navigate to the Posts > All Posts table list view to see all content that has been pushed or pulled to the current site via the Distributor column denoted with the Distributor icon (Distributor icon). Rows that include the Distributor icon will link off that icon to the origin site and post where that content was either pushed or pulled from.

All Posts screen showing Distributor links for pushed and pulled content

Support Level

Active: 10up is actively working on this, and we expect to continue work for the foreseeable future including keeping tested up to the most recent version of WordPress. Bug reports, feature requests, questions, and pull requests are welcome.

Known Caveats/Issues

Remote Request Timeouts - With external connections, HTTP requests are sent back and forth - creating posts, transferring images, syncing post updates, etc. In certain situations, mostly commonly when distributing posts with a large number of images (or very large file sizes), using poorly configured or saturated servers / hosts, or using plugins that add significant weight to post creation, Distributor requests can fail. Although we do some error handling, there are certain cases in which post distribution can fail silently. If distribution requests are taking a long time to load and/or failing, consider adjusting the timeout; you can filter the timeout for pushing external posts using the dt_push_post_timeout filter. More advanced handling of large content requests, and improved error handling is on the road map for a future update.

Post Meta Associations - A distributed post includes all of the post meta from the original version. Sometimes arbitrary post meta references an ID for another piece of content on the original site. Distributor does not "bring along" the referenced content or update references for arbitrary post meta (it will take care of updating references in the case of core WordPress features, such as the featured image ID). This issue is very common when using field management plugins like Advanced Custom Fields (ACF). This can be addressed on a case by case basis by extending the plugin; for external connections, you can manually handle post meta associations using the dt_push_post hook. For internal connections, use the dt_push_post hook. Note that while named the same, these hooks accept different parameters.

Deleting Distributed Posts - When a post that has been distributed is deleted, the distributed copies will become unlinked ("forked") from the original and thus become editable. Similarly, when a distributed post is unpublished, distributed copies will not be unpublished. More sophisticated "removal" workflow is on the road map for a future update.

Gutenberg Block Mismatch - When distributing a Gutenberg post to another site that supports Gutenberg, if a block in the post does not exist on the receiving site, the block will be converted to a "Classic" HTML block.

Parent Posts - Distributor does not "bring along" parent (or child posts). If your post (or custom post type) has a parent or a child, it will distribute it as if it's an orphan.

Custom Post Type Support - Internal Connections (multisite) support multiple post types. In order for distribution to work with External Connections that have custom post type content, that post type needs to be registered with the argument show_in_rest => true on the external site.

Unable to Push to New Custom Post Types - If new Custom Post Types are created after establishing an External Connection, you will only be able to Pull those from an External Connection. To ensure you are able to Push new Custom Post Types to an External Connection, you will need to update the External Connection by editing it and then clicking the Update connection button.

Backwards Compatibility - While we strive to be mindful of backwards compatibility much the same way WordPress itself is, we do not currently guarantee continued interoperability between different versions of Distributor. We assume the current userbase for this plugin has a high degree of control over any site that has been set up as an external connection and urge you to keep Distributor up to date.

Distributing Post content - By default, post content is rendered before being copied. This means that shortcodes are expanded before being distributed and remote posts will not have the shortcode, but rather the expanded HTML content.

Distributing Authors - By default, distributed posts reference the original site as the "author" with a link to it. This can be altered by extending Distributor with custom code to make it sync authors.

Distributing Post Date - By default, the "post date" on distributed posts is the date its published on the remote site, not the date published on the origin site. This can be overridden by extending Distributor with custom code to make it preserve the post date.

Distributing Canonical URL - By default, canonical URL of distributed post will point to original content, which corresponds to SEO best practices. This can be overridden by extending Distributor with custom code and removing Distributor's default front end canonical URL filtering (look for 'get_canonical_url' and 'wpseo_canonical').

Drafts as Preferred Status - By default, drafts are the preferred status and can't be changed at the source site.

Conflicts with Security plugins - Oftentimes the communication Distributor attempts to make across sites using the REST API will be flagged by various security plugins and surreptitiously blocked. If you run into an issue like this, please reach out to the support for your security plugin and ask about getting Distributor unblocked (here is an example for doing so with Wordfence).

Developers

See Distributor Developer Documentation.

Changelog

A complete listing of all notable changes to Distributor are documented in CHANGELOG.md.

Contributing

Please read CODE_OF_CONDUCT.md for details on our code of conduct and CONTRIBUTING.md for details on the process for submitting pull requests to us.

Like what you see?

distributor's People

Contributors

arsendovlatyan avatar barryceelen avatar cadic avatar dependabot[bot] avatar dhanendran avatar dinhtungdu avatar dkotter avatar faisal-alvi avatar helen avatar iamdharmesh avatar jakemgold avatar jaywood avatar jeffpaul avatar joshuaabenazer avatar leogermani avatar madmax3365 avatar petenelson avatar peterwilsoncc avatar ravinderk avatar ritesh-patel avatar robbiet480 avatar roshniahuja avatar samikeijonen avatar sethrubenstein avatar sksaju avatar stephanieleary avatar technosailor avatar theskinnyghost avatar tlovett1 avatar tomjn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

distributor's Issues

ACF content not distributed

I am using Distributor on a complex multisite installation serving landing page builder developed using ACF as the foundation.

We are handling images on sites via Delicious Brains WP Offload S3 plugin and when distributing a page, it copies all fields correctly except the image fields (possibly related to #77). The physical image is copied over to the destination site, with correct S3 URL, but it is not tied to the field, the image field is always empty.

I have distributed a dozen of posts and the image field was newer properly populated.

So far this is the only issue I have stumbled upon after using the plugin for a while in a pretty complex environment. Great job.

.innerHTML = ...

I spotted a large number of these cases where HTML strings are turned into DOM nodes, either passed straight from a variable, or assembled with strings.

For example in assets/js/src/admin-external-connection.js:

						if (response.data.endpoint_suggestion) {
							endpointResult.innerHTML = ' ' + dt.endpoint_suggestion + ' <a class="suggest">' + response.data.endpoint_suggestion + '</a>';
						} else {
							endpointResult.innerHTML = dt.bad_connection;
						}

These should be using DOM node construction. I can see that in the above example, the bad connection may just be a language string, but in that scenario a text node should be created rather than blindly trusting the value is safe

.com VIP Image sideloading

Distributor bundles extra fields when creating posts then uses that to side load images.

However on .com VIP this means broken images as the machines serving requests do not have write access. The result would be broken 404 images in distributor posts

We do have the core media endpoints that could be used, if distributor pre-populated the attachments prior to the request that would sidestep the issue and prevent the need for the extra rest data on push

In the meantime I'm working with our systems team to see if this can be remedied, though that will take some time and I won't have that information today

Update language / wording to be more consistent

We use phrases like "Distribute" and "Syndicate" interchangeably through the UI; let's take a pass at making this consistent, leaning toward things like "Distribute" instead of "Syndicate" in the menu interface.

Implementing alternate long term authentication solutions

Once some form of #68 gets implemented it won't make much sense to continue using a username/password combination for authentication. Even without #68 being implemented, username and password authentication usually is not the most secure or stable way to authenticate.

I'd like to gather feedback about implementing some form of two way handshaking between Distributor instances to allow for easier initial setup (only having to configure connections from one side, assuming the other side has "allow new connections" set) as well as long term authentication to the REST API using exchanged tokens specific to a single Distributor install instead of username/password. My personal recommendation for token management and authentication would be a forked version of the JWT plugin but instead of generating tokens from username/password, it would generate tokens if a proper request was presented from a previously authorized (via the initial setup handshake) request.

A lot of the groundwork for alternate authentication styles was completed via #58, my initial research shows a new authentication style should pretty much be drop in. I'm not necessarily suggesting username/password auth is even removed quite yet, i'm just looking for an alternative to be provided.

Push unavailable

Hey

I'm probably missing something simple, but my test connections always get this message:

Limited connection established.
Push unavailable.

I'm using the suggested /wp-json endpoint and an Administrator login

Notice and fatal error connecting to site that requires login (Force Login plugin)

Notice: Undefined index: post in /REMOVED/wp-content/plugins/distributor/includes/classes/ExternalConnections/WordPressExternalConnection.php on line 127

Fatal error: Uncaught Error: Cannot use object of type WP_Error as array in /REMOVED/wp-content/plugins/distributor/includes/classes/PullListTable.php:384

Stack trace:

#0 /REMOVED/wp-content/plugins/distributor/includes/pull-ui.php(297): Distributor\PullListTable->prepare_items()
#1 /REMOVED/wp-includes/class-wp-hook.php(286): Distributor\PullUI\dashboard('')
#2 /REMOVED/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array)
#3 /REMOVED/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#4 /REMOVED/wp-admin/admin.php(224): do_action('distributor_pag...')
#5 {main} thrown in /REMOVED/wp-content/plugins/distributor/includes/classes/PullListTable.php on line 384

The above is displayed on the Pull Content screen when connecting to a site that uses the Force Login plugin.

When the Force Login plugin is not active everything in Distributor works as expected .

I use the recommended authentication method (Application Passwords).

Connecting and posting to the site using cURL or Python Requests seems to work fine whether Force Login is active or not.

Let me know if you need any more information.

Cheers!

Improve warning messages when a remote connection cannot be established

Setting up remote connections is causing some confusion with early testers; I think our warning messages might be a bit too vague.

Can we be a bit more specific in catching and explaining common failure use cases? Like the REST API not being available, not finding a secure connection (even linking to a recommended auth plugin), Distributor not being detected on the other end... ?

Only Usable via Site Admin and No Capabilities to Assign to Roles

I'm the only user of multiple sites, actually a mutisite instance, and even I don't do my normal day-to-day edits as an Administrator. My normal account is an Editor. This plugin should have a the ability to set which roles can pull and publish content independently of the plugin configuration settings. As it is I don't see any capabilities define to even assign to existing roles. Perhaps that would be the first step is to add capabilities that someone could assign via a role management plugin.

Selected connection highlighting

The highlight that appears on selected connections makes me think those items can be clicked to un-highlight them (or remove them) from the list on the right. I recommend the item on the left is removed once it's selected. For short lists we could use a simple toggle, but that interaction breaks down once we have a longer, filterable result set. For extra credit, have a very quick (200-300ms) animation of the item moving from the left to the right to further reinforce what's happening.

Featured images don't always share

Hey guys, appreciate the update without the need to compile. I've got it working, but now my featured images sometimes move across and sometimes don't. Regardless of the outcome, Distributor reports back with "There was an issue distributing the post", and there's usually missing custom fields. Thoughts?

Great start, though. Much more reliable than any of the other syndication plugins I've seen and tested, and this is only the beginning!

"As draft" needs font color CSS styling

.distributor-push-wrapper .as-draft should have a color set (white?). Currently it inherits a dark gray from the twentyseventeen theme and is not visible.

screen shot 2018-01-11 at 1 39 30 pm

Add "type": "wordpress-plugin", to the composer.json file

Wanted to see if there are any reasons we would not like to specify that in the composer.json.
This makes it easy for other projects using the plugin as a dependency in their composer.json file. Currently it goes to the vendor directory by default.

Refine handling of hierarchical post types

While hierarchical post types aren't the primary use case, there are plenty of conditions – from custom hierarchical post types, to staging pages, to generic about pages shared across sites – where this is useful. Right now, I don't think we "think" about this at all - it just ignores the hierarchy attribute.

Near term, I think we just need to refine the UX to make it obvious that we're not going to do anything with hierarchy. I think that can just mean that – if the current post has a parent or child (in the literal sense, don't want to include things like media or drafts) – the "Distributor" toolbar menu explains / warns that parent / child relationships are not distributed.

I can see a potential future iteration that adds an option to "Include all child posts" (for a use case like a generic about page with subpages or learning module with several child items coming over).

I'm also not clear how - if at all - we handle showing hierarchy in the pull UI?

Network Site Connections test suite

There should be separate tests files for both NetworkSiteConnections.php and InternalConnections/NetworkSiteConnection.php.

For NetworkSiteConnection.php, we will need to test:

  • Push
  • Pull
  • Remote get

External connection on site with HTTP Auth

Hi guys.

I am having trouble in establishing a valid connection with our staging sites.

All of them are behind Basic HTTP Auth, and it looks like at the moment there is no way around it except removing it and using the recommend Application Passwords plugin.

Is this authorization type permanent solution? It could be an issue for any site that is behind Basic HTTP Auth for any reason.

Push/Pull UI testing suite

These will be tricky. There might not be much we can do. However, there is a ton of logic in these files around display of connections. It would be awesome to test some of it.

Distributor link in topbar not working

Hey guys, I'm testing this on both my beta site and the site I'm trying to link it to, and neither are firing the script when you click the "Distributor" button in the top bar of the post. I've tested with plugins all off and on, and with caching clear, and nothing's showing up.

Wordpress version is 4.9.4. Tested on both HTTP and HTTPS, with current version. Any thoughts?

Default view should be global recent posts list

If the default behavior of the Pull Content view was showing me the latest posts on the multisite network, I could:

  • get an overview of posting acitivity without leaving the plugin.
  • avoid having to select an option from the drop down menu in most cases.

Pulls Generated Excerpt as Custom Excerpt

I pulled a piece of content that did not have a custom excerpt defined, but it takes a generated excerpt and saves it as an explicit custom excerpt.

From the site doing the pulling:
screen shot 2018-01-30 at 10 37 17 am

Distributing posts with correct author

We have a pretty big network of sites. All of them need to show proper author information. I see that as of right now Distributor will set the distributed posts author to the authenticated users ID. I'd like to change this (and am willing to do the work myself). Here's two possible solutions:

  1. The simplest method is to just pass through the user ID of the original post author and leave it up to admins to make sure their user IDs are synced across all sites. This gets a bit easier if you are using an SSO plugin of some kind.
  2. Add a hook to the post creation (or use the existing dt_item_mapping for pull or dt_push_post_args for push filter) to allow passing the "correct" author ID based on the existing post author ID and what site we are posting to. This would require end users to have a map or database of current site author ID to external site author ID. Not the hardest thing in the world for a lot of admins to build, but still a pretty high bar. If people think this is the best route, I would most likely write my own solution and document it in README.md. Eventually, a UI could possible be created in Distributor to manage this.

Anyway, looking for feedback on which path to go down or a different path entirely. I'm looking to get this done ASAP and would of course submit any changes to the plugin back.

Plugin not creating/managing ads.txt file at all

I installed the plugin on a client site hosted on WP Engine and the plugin's core functionality of creating or managing the ads.txt file isn't working.

An ads.txt file already exists for the website. Loading up the plugin for the first time shows a blank textbox. Entering something in will save the changes on the page, but the ads.txt file won't change.

Deleting the ads.txt file on the server doesn't have any impact.

Automated runs would be a big help

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?

Document sync log limits

Sync logging is stored in options/post meta. This will pose problems on high usage websites. We need to document.

OAuth2 Authentication

For the plugin to work on WP.com it'll need to use the OAuth2 Authentication .com uses, the basic Auth mechanism won't work/pass review

External Connection Authentication Method

Right now we are validating signatures within the API endpoint. This it the wrong filter to be returning a 403. We should be checking signatures on the rest_authentication_errors filter.

`is_vip` checks assume .com

The is_vip checks work well for WordPress.com VIP sites, but they unfairly remove features from VIP Go. E..g the network connection with switch_blog could pass review on a VIP Go site, but would never be available

Similarly some checks assume too much, e.g.

			if ( is_vip() ) {
				$types_response = vip_safe_wp_remote_get( $types_path, array(
						'timeout' => 5,
					)
				);

Here the conditional should be if ( function_exists( 'vip_safe_wp_remote_get' ) ) { which would make the code more flexible and adaptable

Feature Request: Filter to add meta fields to synchronisation

Hi Guys,

Is it possible to create a custom action/filter which allows us to add/edit meta fields of articles to the synchronisation?

The default action now is to synchronize all visible metafields, but not the ones that are invisible (starting with a _)

For example we us _yoast_wpseo_primary_category to create listings on our website and that meta field is by default not synchronized. Which I totally understand, but it would be nice to have a hook so I can add it to the synchronisation.

Make it easier to denote a post as "distributed" on the front end

Right now, I don't think there's any "easy" way (without figuring out the post meta) to show that a piece of content (post) has been syndicated / reposted / distributed on the front end, which I would think is a common use case on the front end.

I envision two parts to this (open to feedback).

(1) Create PHP function(s) to output this information. I'd imagine a "the_" type function which prints out the link site named and a preface that can be overridden with an optional parameter, like "Distributed from" (would not return anything if it was forked – maybe that can also be set with an optional parameter - or wasn't distributed). I'd also imagine a "get_the_" type function which could return an array of information: the name of the site it was distributed from, the link to the original, and maybe some other information like whether it was forked.

(2) In a later version, I can imagine an optional setting (off by default) that injects this information, for someone who doesn't want to edit code on each site. For example, it might "take over" the author byline (instead of "Post by [linked author name]" it could say "Post by [Site Name linked to original]", or be injected at the top of the post.

Distributor should work for (public) custom post types

This issue was originally reported by @coenve who also provided the cod used to correct the issue in their testing. subscriptions may need attention as well.

I was missing support for custom post types. After a couple of hours of hacking and changing your code, I just got it finished and working.

You probably tried to create it on an earlier date, but if you use post_type instead of type as an url parameter, it doesn’t work. Wordpress doesn’t allow it, so I used type instead. Feel free you my code and maybe optimize it a bit. It works ☺

WordpressExternalConnection.php

$post = $this->remote_get( [ 'id' => $item_array['remote_post_id'] );
->

 $post = $this->remote_get( [ 'id' => $item_array['remote_post_id'], 'post_type' => $_GET['type'] ] );

if(empty($post_array['post_excerpt'])) {  unset($post_array['post_excerpt']); } 

BEFORE: $new_post = wp_insert…..

PullListTable.php

$remote_get_args['post_type'] = 'post'; ->

$remote_get_args['post_type'] = (!empty($_GET['type'])) ? $_GET['type'] : 'post';

In the form at the bottom of pull-ui.php

<input type="hidden" name="type" value="<?php echo $_GET['type']; ?>">
At the top of pull-ui after the connections select

<select id="ptype" name="type" method="get">

                                        <?php

                                                $local_post_types = get_post_types(array('public' => true, 'publicly_queryable' => true));

                                                foreach ($local_post_types as $ptype) :

                                                        if($ptype == $_GET['type']) { $selected = true; } else { $selected = false; }

                                        ?>

                                                        <option <?php selected( true, $selected ); ?> data-pull-url="<?php echo esc_url( admin_url( 'admin.php?page=pull&type='.$ptype.'&connection_type=' . $type . '&connection_id=' . $id ) ); ?>">          

<?php echo esc_html($ptype); ?></option>

                                        <?php endforeach; ?>

                                </select>

Only thing you have to change is the .JS-file that the url changes if people use the select box.

wp-admin/admin.php?page=pull&type=<POSTTYPENAME>

Unusable on multisite

The plugin seems to have a few issues on multisite. My use case is I would like to have one blog in the multisite and have it shared across all the others. A total of about 30 sites.

  1. Loading the pull page is very very slow.
  2. Not all site the sites on the network are listed in the dropdown.
  3. There is no distinction between post types when content is listed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.