WordPress.org

Ready to get started?Download WordPress

Forums

Posts 2 Posts
[resolved] Metaboxes and front-end connections gone after upgrade (8 posts)

  1. cwulff
    Member
    Posted 1 year ago #

    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.

    http://wordpress.org/extend/plugins/posts-to-posts/

  2. itinerant
    Member
    Posted 1 year ago #

    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.

  3. itinerant
    Member
    Posted 1 year ago #

    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.

  4. scribu
    Member
    Plugin Author

    Posted 1 year ago #

    @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?

  5. cwulff
    Member
    Posted 1 year ago #

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

  6. cwulff
    Member
    Posted 1 year ago #

    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

  7. scribu
    Member
    Plugin Author

    Posted 1 year ago #

    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'.

  8. cwulff
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic