Posts 2 Posts Connections
  • Stranger
    Posts: 4
    Topics: 3
    Charles September 14, 2012

    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.

  • Stranger
    Posts: 4
    Topics: 3
    Charles September 14, 2012

    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?

  • Support Maven
    Posts: 1898
    Topics: 10
    Answers: 199
    Leah September 25, 2012

    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

  • Power User
    Posts: 4017
    Topics: 3
    Answers: 763
    Jonah September 25, 2012

    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

  • Stranger
    Posts: 4
    Topics: 3
    Charles September 25, 2012

    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!

  • Power User
    Posts: 4017
    Topics: 3
    Answers: 763
    Jonah September 25, 2012

    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

  • Stranger
    Posts: 4
    Topics: 3
    Charles September 25, 2012

    Thanks Jonah!

  • Ninja Developer
    Posts: 52

    Answers: 12
    Tim Wood September 25, 2012

    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.

  • Stranger
    Posts: 4
    Topics: 3
    Charles September 25, 2012

    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!

  • Ninja Developer
    Posts: 52

    Answers: 12
    Tim Wood October 1, 2012
    Answered ✔

    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.

  • Ninja Developer
    Posts: 52

    Answers: 12
    Tim Wood October 1, 2012

    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

  • Support Maven
    Posts: 1898
    Topics: 10
    Answers: 199
    Leah October 8, 2012

    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

  • Viewing 12 posts - 1 through 12 (of 12 total)