Posts 2 Posts Connections

Home Forums Calendar Products Events Calendar PRO Posts 2 Posts Connections

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #25097
    Charles
    Member

    Hello,
    Firstly, thanks so much for a great plugin. It’s exactly what my client needed and has helped me deliver some added value in the project.

    Here is what I’m trying to accomplish:
    We hold events for non-profits. Each event has a unique set of sponsors. I’ve created a custom post type called sponsors. Using the Posts 2 Posts plugin, I’ve registered a connection between tribe_events and sponsors. While editing an event post, I can add sponsors and all seems to be working great.

    Things break down when I try to display the connected sponsors on a single event post page. I have been in contact with scribu, the Posts 2 Posts author and he isn’t sure why this is happening. As a test, I’ve registered another connection type between two other post types and was able to successfully display connected posts.

    The WP Debug bar is giving me the following notices when on the events list page:
    NOTICE: wp-content/themes/clarity/events/list.php:33 – Undefined variable: post
    NOTICE: wp-content/themes/clarity/events/list.php:33 – Trying to get property of non-object

    On an event detail page, I get the following:
    NOTICE: wp-includes/query.php:2800 – Undefined offset: 1
    NOTICE: wp-includes/query.php:3592 – Trying to get property of non-object
    NOTICE: wp-includes/post-template.php:30 – Trying to get property of non-object
    NOTICE: wp-includes/post-template.php:206 – Trying to get property of non-object

    Is there any advice you can give me on troubleshooting this issue?

    Thanks so much.

    #25155
    Charles
    Member

    Does the fact that I haven’t received any response mean that you don’t believe that this issue is caused by the Event Calendar plugin or is this being investigated?

    #25684
    Leah
    Member

    Hey Charles,

    I apologize, this thread seems to have slipped through the cracks. I’ve alerted our developers to your problem and one of them will get back to you as soon as possible with a more substantial answer. Thank you for your patience!

    Cheers,
    Leah

    #25688
    Jonah
    Participant

    Hi Charles,

    Can you please provide some more code detail/samples of what you’re working with for the connections. I’m primarily interested in the code you have to display posts on the single event pages. The first errors above seem to indicate problems with the list template, are you trying to display connected posts there too? Can you post code samples for the list too if it’s different from your single event code? Please post to http://snippi.com/

    Thanks,
    Jonah

    #25690
    Charles
    Member

    Thanks Jonah! I really appreciate the support. More detail is here: http://snippi.com/s/o3rwn1m
    Please Let me know if you need anymore detail.
    Thanks!

    #25698
    Jonah
    Participant

    Hi Charles,

    You’re welcome. I couldn’t figure it out myself so I’m going to have to ask another dev to take a look. Stay tuned!

    – Jonah

    #25699
    Charles
    Member

    Thanks Jonah!

    #25727
    Timothy Wood
    Participant

    Hi Charles, I am one of the core devs on The Events Calendar. I have been testing with the code snippit you supplied and when I don’t create the custom post type (CPT) of sponsor I get similar errors:
    Notice: Trying to get property of non-object in /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 /wp-content/plugins/posts-to-posts/core/side.php on line 84
    Notice: Trying to get property of non-object in /wp-content/plugins/posts-to-posts/core/side.php on line 80
    Notice: Trying to get property of non-object in /wp-content/plugins/posts-to-posts/core/side.php on line 80

    However, when I create a CPT or attach it to an existing post type the errors disappear. I am wondering how you are setting up the CPT and if they are being initialized after ‘p2p_init’ fires. If you don’t mind submitting your code for the CPT as well so I can make sure I am tying into the same CPT logic you have setup.

    #25733
    Charles
    Member

    Thanks Timothy!

    I’ve posted more detail about how I create the custom post type and register the connection here: http://snippi.com/s/ojpsg8n

    I really appreciate your time looking into my issue. Thanks!

    #25962
    Timothy Wood
    Participant

    Charles, I have taken your code snippet and been able to find the issue. Currently it is a conflict with how the Post 2 Post relationship queries are built and how The Event Calendar queries respond when a query is run for events. The issue arrises with how nested select queries function when P2P expects a single column. A side note on this conflict, exposes a bit of a performance hit with how the nested select query operates.

    For v2.0.9 this will remain a bug, however if you use the following snippet it will resolve the issue in the interim https://gist.github.com/3815849. In our next release we have overhauled how query management works within TEC quite substantially and this should not be an issue moving forward.

    #25964
    Timothy Wood
    Participant

    FYI if you are interested in the SQL performance issue it was highlighted in a ticket on the repo this past month, a fix may be in hand at which point may resolve this issue as well. https://github.com/scribu/wp-posts-to-posts/issues/219

    #26266
    Leah
    Member

    Hi Charles,

    Does Timothy’s code above help you out? We’ll have an official fix out in our next release but hopefully that can tide you over until then. If you have any other questions, don’t hesitate to reach out.

    Cheers,
    Leah

    #977938
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Posts 2 Posts Connections’ is closed to new replies.