• Resolved cwulff

    (@cwulff)


    Hi there,

    Thanks for the amazing plugin. Having some issues with the recent upgrade though as the metabox in admin and the connections on the front-end have disappeared. Debug error given was:

    <b>Notice</b>: Trying to get property of non-object in ... /wp-content/plugins/posts-to-posts/core/side.php</b> on line <b>80</b><br />
    <b>Notice</b>: Trying to get property of non-object in ... /wp-content/plugins/posts-to-posts/core/side.php</b> on line <b>84</b><br />

    Connections show up fine in admin under tools > connection types with the right format and number of connections displayed. They just don’t display on the single post edit page or the CPT’s single template. Connection between the two CPTs seems to be fine, just causing problems in the connection between CPT and Posts.

    Here’s the registration info:

    function my_connection_types() {
    	// Make sure the Posts 2 Posts plugin is active.
    	if ( !function_exists( 'p2p_register_connection_type' ) )
    		return;
    
    	p2p_register_connection_type( array(
    		'name' => 'partners_to_iecs',
    		'from' => 'ac_partner',
    		'to' => 'ac_iec',
    		'reciprocal' => true
    	) );
    
    	p2p_register_connection_type( array(
    		'name' => 'posts_to_iecs',
    		'from' => 'posts',
    		'to' => 'ac_iec'
    	) );
    
    	p2p_register_connection_type( array(
    		'name' => 'posts_to_partners',
    		'from' => 'posts',
    		'to' => 'ac_partner'
    	) );
    
    }
    add_action( 'wp_loaded', 'my_connection_types' );

    I’m wondering if I missed something in the plugin update notes that I was supposed to change. Many thanks.

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Tim Smith

    (@creativeinfusion)

    Similar problem for us. As you we have no connections listed in metaboxes on CPT page in the admin, but listed on the tools page.

    We do get them on the front end, both from a custom WP_Query and from a p2p_get_connections call. How are you accessing them on the front end?

    I was also using the methods on the objects returned from each_connected() but they have gone, probably as a result of the changelog item which says “fixed each_connected() returning wrapped objects”.
    i.e. I was using the get_title and get_permalink methods similar to this

    foreach $post->connected as $connected :
    $connected->get_title();
    $connected->get_permalink();

    Easy to change (the properties are there) but I’m wondering if that change has caused the issue in the admin.

    Tim Smith

    (@creativeinfusion)

    My comment is probably a red herring.

    I traced our problem to a conflict between the Query Multiple Taxonomies and Posts 2 Posts plugins – it seems the wp admin doesn’t like the two plugins having different versions of the files in mustache and scb directories. Updating the files in QMT has resolved our issue.

    Plugin Author scribu

    (@scribu)

    @creativeinfusion: The development version of QMT now contains the same version of Mustache as P2P. Thanks for tracking that down.

    @cwulff: Were you also using the QMT plugin?

    Thread Starter cwulff

    (@cwulff)

    Alas, I am not (though I really should be – nice plugin).

    Thread Starter cwulff

    (@cwulff)

    Turned off all the other plugins and got this as the error:

    Notice: Trying to get property of non-object in /home/…/wp-content/plugins/posts-to-posts/core/side.php on line 84

    Warning: get_object_vars() expects parameter 1 to be object, null given in /home/…/wp-content/plugins/posts-to-posts/core/side.php on line 84

    Notice: Trying to get property of non-object in /home/…/wp-content/plugins/posts-to-posts/core/side.php on line 80

    Notice: Trying to get property of non-object in /home/…/wp-content/plugins/posts-to-posts/core/side.php on line 80

    Notice: Trying to get property of non-object in /home/…/wp-content/plugins/posts-to-posts/core/side.php on line 84

    Warning: get_object_vars() expects parameter 1 to be object, null given in /home/…/wp-content/plugins/posts-to-posts/core/side.php on line 84

    Notice: Trying to get property of non-object in /home/…/wp-content/plugins/posts-to-posts/core/side.php on line 80

    Notice: Trying to get property of non-object in /home/…/wp-content/plugins/posts-to-posts/core/side.php on line 80

    Plugin Author scribu

    (@scribu)

    I’m confused by these two connection types:

    p2p_register_connection_type( array(
    		'name' => 'posts_to_iecs',
    		'from' => 'posts',
    		'to' => 'ac_iec'
    	) );
    
    	p2p_register_connection_type( array(
    		'name' => 'posts_to_partners',
    		'from' => 'posts',
    		'to' => 'ac_partner'
    	) );

    The correct name is 'post', not 'posts'.

    Thread Starter cwulff

    (@cwulff)

    I’ll be damned. I don’t know how they got changed but will have to figure that out (they’d been working for months).

    Thanks for taking the time to look at it and for your help.

    Cheers.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Posts 2 Posts] Metaboxes and front-end connections gone after upgrade’ is closed to new replies.