Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/npm_and_yarn/axios-and-wordpre…
Browse files Browse the repository at this point in the history
…ss/scripts-1.6.2
  • Loading branch information
ravinderk authored Jan 3, 2024
2 parents 901e0f7 + ee713ae commit 6e09a81
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 11 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file, per [the Ke

## [Unreleased] - TBD

## [2.0.2] - 2023-11-29
### Added
- New snippet detailing how to disable automatic content updates (props [@dkotter](https://github.com/dkotter), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1145](https://github.com/10up/distributor/pull/1145)).

### Changed
- Show proper external connection status error messages when the status is checked (props [@theskinnyghost](https://github.com/theskinnyghost), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1140](https://github.com/10up/distributor/pull/1140)).
- Updated our docs around how to connect two pieces of existing content (props [@dkotter](https://github.com/dkotter), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1145](https://github.com/10up/distributor/pull/1145)).
- Bump WordPress "tested up to" version 6.4 (props [@severine-pozzo](https://github.com/severine-pozzo), [@QAharshalkadu](https://github.com/QAharshalkadu), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter) via [#1151](https://github.com/10up/distributor/pull/1151)).

### Fixed
- Copy the htaccess file when initilizing the E2E test environment (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@theskinnyghost](https://github.com/theskinnyghost), [@dkotter](https://github.com/dkotter) via [#1143](https://github.com/10up/distributor/pull/1143)).
- Prevent early publishing of scheduled posts when pulled internally (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@maxledoux](https://github.com/maxledoux), [@pcrumm](https://github.com/pcrumm) via [#1156](https://github.com/10up/distributor/pull/1156)).
- Avoid a PHP fatal error when pulling content that has previously been pulled into a different network site (props [@dkotter](https://github.com/dkotter), [@jeffpaul](https://github.com/jeffpaul), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1159](https://github.com/10up/distributor/pull/1159)).

### Security
- Bump `postcss` from 8.4.24 to 8.4.31 (props [@dependabot[bot]](https://github.com/apps/dependabot), [@ravinderk](https://github.com/ravinderk) via [#1141](https://github.com/10up/distributor/pull/1141)).
- Bump `@babel/traverse` from 7.22.5 to 7.23.2 (props [@dependabot[bot]](https://github.com/apps/dependabot), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1147](https://github.com/10up/distributor/pull/1147)).

## [2.0.1] - 2023-09-18
### Changed
- Update from Cypress v10 to v13 (props [@dkotter](https://github.com/dkotter), [@iamdharmesh](https://github.com/iamdharmesh), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1128](https://github.com/10up/distributor/pull/1128)).
Expand Down Expand Up @@ -486,6 +504,7 @@ This adds a post type selector when viewing the Pull Content list for both exter
- Initial closed release.

[Unreleased]: https://github.com/10up/distributor/compare/trunk...develop
[2.0.2]: https://github.com/10up/distributor/compare/2.0.1...2.0.2
[2.0.1]: https://github.com/10up/distributor/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/10up/distributor/compare/1.9.1...2.0.0
[1.9.1]: https://github.com/10up/distributor/compare/1.9.0...1.9.1
Expand Down
2 changes: 1 addition & 1 deletion CREDITS.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions distributor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin URI: https://github.com/10up/distributor
* Update URI: https://distributorplugin.com
* Description: Makes it easy to distribute and reuse content across your websites, whether inside of a multisite or across the web.
* Version: 2.0.1
* Version: 2.0.2
* Requires at least: 5.7
* Requires PHP: 7.4
* Author: 10up Inc.
Expand All @@ -28,7 +28,7 @@
exit; // Exit if accessed directly.
}

define( 'DT_VERSION', '2.0.1' );
define( 'DT_VERSION', '2.0.2' );
define( 'DT_PLUGIN_FILE', preg_replace( '#^.*plugins/(.*)$#i', '$1', __FILE__ ) );
define( 'DT_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
define( 'DT_PLUGIN_FULL_FILE', __FILE__ );
Expand Down
22 changes: 19 additions & 3 deletions docs/snippets.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,27 @@ add_action( 'plugins_loaded', function() {
*
* This filter is used to filter the arguments sent to the remote server during a push. The below code snippet passes the original published date to the new pushed post and sets the same published date instead of setting it as per the current time.
*/
add_filter( 'dt_push_post_args', function( $post_body, $post ) {
$post_body['post_date'] = $post->post_date;
add_filter( 'dt_push_post_args', function( $post_body, $post, $args, $connection ) {

// When pushing to an external connection, we use the REST API, so the name of the field is `date`.
// But when pushing to an internal connection, the attributes are sent to wp_insert_post, which expects `post_date`.
$field_prefix =( $connection instanceof \Distributor\ExternalConnections\WordPressExternalConnection ) ? '' : 'post_';

$post_body[ $field_prefix . 'date'] = $post->post_date;
$post_body[ $field_prefix . 'date_gmt'] = $post->post_date_gmt;

return $post_body;
}, 10, 2 );
}, 10, 4 );

/**
* This filters the the arguments passed into wp_insert_post during a pull
*/
add_filter( 'dt_pull_post_args', function( $post_array, $remote_id, $post ) {
$post_array['post_date'] = $post->post_date;
$post_array['post_date_gmt'] = $post->post_date_gmt;

return $post_array;
}, 10, 3 );
```

### Automatically unlink posts
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "distributor",
"version": "2.0.1",
"version": "2.0.2",
"description": "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.",
"author": {
"name": "10up",
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: content, distribution, syndication, management
Requires at least: 5.7
Tested up to: 6.4
Requires PHP: 7.4
Stable tag: 2.0.1
Stable tag: 2.0.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down
2 changes: 1 addition & 1 deletion tests/php/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
WP_Mock::bootstrap();

define( 'DT_PLUGIN_PATH', dirname( __DIR__, 2 ) );
define( 'DT_VERSION', '2.0.1' );
define( 'DT_VERSION', '2.0.2' );

require_once __DIR__ . '/includes/common.php';
require_once __DIR__ . '/includes/TestCase.php';
Expand Down

0 comments on commit 6e09a81

Please sign in to comment.