Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author scribu

    (@scribu)

    You should pass a user object (A), or set the direction manually (B):

    A) $ctype->get_p2p_id( get_userdata( $user_id ), $post_id )
    B)  $ctype->set_direction( 'to' )->get_p2p_id( $user_id, $post_id )
    Thread Starter mendelk

    (@mendelk)

    Thank you and I can confirm that both options work.

    I have to confess to not understanding why this is, as this is a user-to-post connection (not user-to-user), so why can’t the direction be determined?

    When the order is reversed (post-to-user), it does give the correct information, even with just the user id, and not the user object.

    Anyways, thank you!

    Plugin Author scribu

    (@scribu)

    When you pass an ID as the first argument, it always expects that it’s a post, since you can have both a post and a user with the same id.

    Passing full objects avoids this ambiguity, since it can determine if it’s dealing with a user or a post.

    Thread Starter mendelk

    (@mendelk)

    Aha ok, got it!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Posts 2 Posts] User to post issue’ is closed to new replies.