Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
},
"require-dev": {
"10up/phpcs-composer": "^3.0",
"doctrine/instantiator": "^1.5",
"phpcompatibility/php-compatibility": "dev-develop as 9.99.99",
"phpunit/phpunit": "^9.0",
"yoast/phpunit-polyfills": "^4.0"
Expand Down
27 changes: 14 additions & 13 deletions composer.lock

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

12 changes: 12 additions & 0 deletions includes/Relationships/PostToPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,18 @@ public function save_sort_data( $object_id, $ordered_ids ) {
/** @var \TenUp\ContentConnect\Tables\PostToPost $table */
$table = Plugin::instance()->get_table( 'p2p' );
$table->replace_bulk( $fields, $data );

/**
* Fires after a relationship order has been updated
*
* @since 2.0.0
*
* @param int $object_id ID of the object we're ordering on (post ID, or user ID for user-to-post).
* @param int[] $ordered_ids Ordered IDs of the related objects.
* @param string $name Relationship name.
* @param string $type Relationship type (post-to-post|post-to-user|user-to-post).
*/
do_action( 'tenup-content-connect-update-relationships-order', $object_id, $ordered_ids, $this->name, 'post-to-post' );
}

/**
Expand Down
10 changes: 10 additions & 0 deletions includes/Relationships/PostToUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ public function save_post_to_user_sort_data( $object_id, $ordered_user_ids ) {
/** @var \TenUp\ContentConnect\Tables\PostToUser $table */
$table = Plugin::instance()->get_table( 'p2u' );
$table->replace_bulk( $fields, $data );

/**
* This action is documented in PostToPost.php
*/
do_action( 'tenup-content-connect-update-relationships-order', $object_id, $ordered_user_ids, $this->name, 'post-to-user' );
}

/**
Expand Down Expand Up @@ -252,6 +257,11 @@ public function save_user_to_post_sort_data( $user_id, $ordered_post_ids ) {
/** @var \TenUp\ContentConnect\Tables\PostToUser $table */
$table = Plugin::instance()->get_table( 'p2u' );
$table->replace_bulk( $fields, $data );

/**
* This action is documented in PostToPost.php
*/
do_action( 'tenup-content-connect-update-relationships-order', $user_id, $ordered_post_ids, $this->name, 'user-to-post' );
}

/**
Expand Down
Loading