Skip to content

Introduce tenup-content-connect-update-relationships-order action - #123

Merged
s3rgiosan merged 3 commits into
developfrom
feature/tenup-content-connect-update-relationships-order
Aug 14, 2026
Merged

Introduce tenup-content-connect-update-relationships-order action#123
s3rgiosan merged 3 commits into
developfrom
feature/tenup-content-connect-update-relationships-order

Conversation

@s3rgiosan

Copy link
Copy Markdown
Member

Description of the Change

Introduces a new tenup-content-connect-update-relationships-order action so extenders can run logic after relationship order is saved. It fires from PostToPost::save_sort_data() and both PostToUser sort methods, covering all three directions — post-to-post, post-to-user, and user-to-post — and passes the object ID, the ordered IDs, the relationship name, and the relationship type.

This is a rebase of #115 (@ocean90) onto the 2.0.0 line. Changes vs. the original PR:

  • Resolved a trivial whitespace/alignment conflict against develop (kept develop's formatting).
  • Bumped the docblock @since from 1.7.0 to 2.0.0 (1.7.0 never shipped).
  • Corrected the @param docs on the canonical block: $object_id also carries a user ID in the user-to-post fire, so the description is now type-agnostic.

Original authorship is preserved (Author: Dominik Schilling, plus a Co-authored-by trailer).

Closes #114

How to test the Change

  1. Register a post-to-post and a post-to-user relationship with sortable order enabled.
  2. Hook the new action:
    add_action(
        'tenup-content-connect-update-relationships-order',
        function ( $object_id, $ordered_ids, $name, $type ) {
            error_log( "order updated: {$type} / {$name} / {$object_id} => " . implode( ',', $ordered_ids ) );
        },
        10,
        4
    );
  3. Reorder related items on a post edit screen (post-to-post and post-to-user) and save.
  4. Confirm the action fires once per save with the correct $type (post-to-post, post-to-user) and the ordered IDs matching the UI.
  5. For user-to-post, trigger PostToUser::save_user_to_post_order() (API level) and confirm $object_id is the user ID and $type is user-to-post.

Changelog Entry

Added - tenup-content-connect-update-relationships-order action for developers.

Credits

Props @ocean90

Checklist:

Co-authored-by: Dominik Schilling <dominikschilling+git@gmail.com>
@s3rgiosan
s3rgiosan merged commit 4913b24 into develop Aug 14, 2026
15 checks passed
@s3rgiosan
s3rgiosan deleted the feature/tenup-content-connect-update-relationships-order branch August 14, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce actions after sort order has been updated

3 participants