scribu/wp-posts-to-posts — Issue #70: Connections don't work when multiple connections are registered
Author: Mompracem
Created: 2011-11-29 14:31:42+00:00
State: open

Hi Scribu,

I see you just replied to me about my question concerning the possibility of connecting an array of custom post types to a post type

I wasn't aware of the possibility but since you confirmed it is possible, I gave a try

however, there's something not functioning as it should

I registered a series of relationships and I found at least two issues

1) When creating a connection like this:

p2p_register_connection_type( array(
'id' => 'supplier-to-contractors',
'from' => 'supplier',
'to' => array('consultant','tourguide','transport'),
'reciprocal' => true,
'title' => array( 'from' => __('Connected professionals', 'my_theme_textdomain), 'to' => __('Connected suppliers', 'my_theme_textdomain') )
));

the meta box created shows in the "search" field a text like "Search Consultant" for the meta box in the Supplier post edit page (ie that is the first custom post type in the list) - this would generate a lot of confusion in users; the "search" field should rather display just "search"

2) second issue appears to be of greater concern: when I attempt to connect a post to another, something breaks... Search functionality and "view all" list seem fine. But if I add a post from the custom post types selected as in the code above, it adds the a post "Consultant", regardless of what I chose (there's no such post named "Consultant", that's a custom post type label in my setup). If I attempt to save the post anyway, connection information (which is wrong in the first place) is not saved either.

Problems 1 & 2 appear also on other custom post types, regardless of the custom post types connected or attempted post connections.