• Resolved owenwalz

    (@owenwalz)


    Hey, just upgraded to 1.0. Love it.
    Unfortunately, I have a small issue:
    A while back I registered a connection type between ‘Events’ and ‘People,’ (called ‘Credits), then filled in a ton of connections. No data type specified.
    Now I’ve added a second connection type between the same post types, called ‘Spotlight.’ I gave spotlight its own data type.
    Now, when I add a ‘Spotlight’ connection between events and people, I see it show up in the ‘Credits’ area as well. Seems there is a crossed wire somewhere.

    Anything I can do? When I add a data type to the origina ‘Credits’ connection, I lose all the old connections in the meta box UI. Seems to treat it as a new registration.

    Thanks,

    https://www.ads-software.com/extend/plugins/posts-to-posts/

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

    (@scribu)

    I’m not sure what you mean by “data type”. Please post the calls to p2p_register_connection_type() that you have.

    Thread Starter owenwalz

    (@owenwalz)

    This is the new type that I just added:

    p2p_register_connection_type( array(
    	    'from' => 'event',
    	    'id' => 'spotlight',
    	    'to' => array('event', 'person', 'news'),
    	    'title' => 'Spotlight',
    		'reciprocal' => false,
    		'data' => array( 'type' => 'spotlight'),
    		'show_ui' => 'from',
    		'sortable' => 'any',
    		'fields' => array(
    			'alt_title' => 'Alternate Title (Optional)'
    		)
    	) );

    This was already registered and contains a lot of connections:

    p2p_register_connection_type( array(
            'from' => 'event',
            'to' => 'person',
    		'reciprocal' => true,
    		'sortable' => 'any',
    		'title' => array( 'from' => 'Cast & Crew', 'to' => 'Credits' ),
    		'fields' => array(
    		    'credit' => 'Credit',
    		    'credit_cat' => array(
    				'title' => 'Credit Category',
    				'values' => array( 'Playwright', 'Director', 'Assistant Director', 'Cast', 'Production' )
    				)
    	    )
    	) );

    I would add data' => array( 'type' => 'credit') to this second type, but I lose all my old connections when I do so.

    Thanks,

    Plugin Author scribu

    (@scribu)

    You can take advantage of the fact that the older connection types have a ‘credit’ field. You can add something like this to it:

    'to_query_vars' => array(
      'connected_meta' => array( array( 'key' => 'credit' ) )
    )
    Thread Starter owenwalz

    (@owenwalz)

    Thanks. That’s been working well in my templates. To be more specific, I’m hoping to keep ‘spotlight’ connections showing up in the UI for ‘credit’ connections for types ‘person’.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Posts 2 Posts] Multiple connections getting crossed’ is closed to new replies.