Skip to content

Commit 2f49592

Browse files
committed
Pass relationship name to action
1 parent 34f8fa3 commit 2f49592

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

includes/Relationships/PostToPost.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct( $from, $to, $name, $args = array() ) {
4949
$this->from = $from;
5050
$this->to = $to;
5151
$this->id = strtolower( get_class( $this ) ) . "-{$name}-{$from}-" . implode( '.', $to );
52-
52+
5353
parent::__construct( $name, $args );
5454
}
5555

@@ -234,7 +234,7 @@ public function save_sort_data( $object_id, $ordered_ids ) {
234234
'order' => $order
235235
);
236236
}
237-
237+
238238
$fields = array(
239239
'id1' => '%d',
240240
'id2' => '%d',
@@ -252,9 +252,10 @@ public function save_sort_data( $object_id, $ordered_ids ) {
252252
*
253253
* @param int $object_id ID of the post we're ordering on.
254254
* @param int[] $ordered_ids IDs of the posts being ordered
255-
* @param string $type relationship type (post-to-post|post-to-user)
255+
* @param string $name relationship name
256+
* @param string $type relationship type (post-to-post|post-to-user|user-to-post)
256257
*/
257-
do_action( 'tenup-content-connect-update-relationships-order', $object_id, $ordered_ids, 'post-to-post' );
258+
do_action( 'tenup-content-connect-update-relationships-order', $object_id, $ordered_ids, $this->name, 'post-to-post' );
258259
}
259260

260261
}

includes/Relationships/PostToUser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public function save_post_to_user_sort_data( $object_id, $ordered_user_ids ) {
230230
/**
231231
* This action is documented in PostToPost.php
232232
*/
233-
do_action( 'tenup-content-connect-update-relationships-order', $object_id, $ordered_ids, 'post-to-user' );
233+
do_action( 'tenup-content-connect-update-relationships-order', $object_id, $ordered_ids, $this->name, 'post-to-user' );
234234
}
235235

236236
/**
@@ -275,7 +275,7 @@ public function save_user_to_post_sort_data( $user_id, $ordered_post_ids ) {
275275
/**
276276
* This action is documented in PostToPost.php
277277
*/
278-
do_action( 'tenup-content-connect-update-relationships-order', $user_id, $ordered_post_ids, 'user-to-post' );
278+
do_action( 'tenup-content-connect-update-relationships-order', $user_id, $ordered_post_ids, $this->name, 'user-to-post' );
279279
}
280280

281281
}

0 commit comments

Comments
 (0)