Support » Plugin: Posts 2 Posts » [Plugin: Posts 2 Posts] All existing connection gone?

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


    If you were updating from P2P 1.0.1 or older, you should have seen a prompt to upgrade your connections as well. Are you on multisite?

    Thanks scribu, it looks like the previous update does work very well. I did seen the upgrade connection button but it said 0 connections were updated. Anyway, I will update those connections manually since there are just few of them. Thanks again for this great plugin!

    Hi scribu, i have the same issue. I am on multisite and updated from 1.1.2. I am not sure if i got the update notice. But now all my connections are not showing in the damin boxes. They are still there and connected posts can be found in frontend. But only the admin boxes are empty. Is it possible to do the connection updates manually somehow?

    Plugin Author scribu


    Something really strange is going on. Another user reported that they see connections in the admin box, but not in the front-end:

    You can check the p2p_type column in the wp_p2p table using phpMyAdmin.

    Ok, i see that none of the connections has a p2p_type. What can i do now? I have 1364 connections applied in the database (thats totaly correct 🙂 ). I can not change every connection by hand.

    Plugin Author scribu


    If all the p2p_type columns are blank, then you shouldn’t see any connections on the front-end either.

    You can try this:

    1. Go to /wp-admin/options.php
    2. Find the p2p_storage option.
    3. Change the value to 3.
    4. Press Update.

    You should then see a notice to upgrade the connections.

    Hi. I updated to wordpress 3.3 and upgraded the plugin to 1.1.3 and all my connections have been erased. They are still in the database, but in the admin screens AND on the front end, they are not showing up. I went to options.php and changed the p2p_storage to 3 and was prompted to Proceed with updating the connections. However, when i click on that, it says “Upgraded 0 connections” and still my posts are not connected.

    The p2p table shows all the to and from connections with p2p types.

    Also, tried doing a var_dump( post_type_exists( 'posttype' ) ); exit; and it returned bool(false) bool(false) bool(false).

    UPDATE: Sorry, my init priorities between custom post types and the registering p2p relation weren’t in the correct order. Now they are, and it’s returning true, but the problem still exists. No connections on admin panel or front end, but I can still see them in the database.

    Do you know what would cause it to not show the connections on the admin panel and front end, but they still exist in the database?

    Plugin Author scribu


    So the p2p_type column is populated properly.

    Do the P2P boxes in the admin not show up at all or do they show up with no connections?

    Did you try adding define( 'WP_DEBUG', true ); in your wp-config.php?

    The P2P boxes show up, just without the connections. I’m curious: what is the p2p_type column in the database? Is it a hash and how does it get generated?

    This happened last time i updated, and i went in and manually redid the connections. They keep until updating this plugin, and the problem occurs again.

    Debug mode showed a couple warnings, nothing really related:

    Notice: Undefined index: post in /mnt/target02/349133/606198/ on line 449
    Notice: Undefined index: post_ID in /mnt/target02/349133/606198/ on line 449
    Notice: automatic_feed_links is deprecated since version 3.0! Use add_theme_support( 'automatic-feed-links' ) instead. in /mnt/target02/349133/606198/ on line 3458
    Notice: Use of undefined constant core_mods - assumed 'core_mods' in /mnt/target02/349133/606198/ on line 42
    Notice: wp_deregister_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /mnt/target02/349133/606198/ on line 3578
    Plugin Author scribu


    what is the p2p_type column in the database? Is it a hash and how does it get generated?

    It’s the name of the connection type. If you don’t set the ‘name’ parameter when calling p2p_register_connection_type(), it generates a hash based on the other arguments.

    Firstly, thanks scribu you got me going in the right direction.

    The issue ended up being that I wasn’t setting the name of the connection type, one of the paramaters that makes up the hash must have changed on update. This resulted in a different hash after the update, and the apparent “loss” of data that I was experiencing.

    To fix without reentering data:
    I changed the name of my connection in the p2p_register_connection_type to whatever it was going to be, then looked in my wp_p2p table to find what the hash types hook up to using a query like this one:

    SELECT DISTINCT p2p_type,  fromtype.post_type AS fromtype,  totype.post_type AS totype
    from wp_p2p
    inner join wp_posts as fromtype ON wp_p2p.p2p_from = fromtype.ID
    inner join wp_posts as totype ON wp_p2p.p2p_to = totype.ID

    Then after determining which hash type relates to which connection name, run this on each one to update

    UPDATE wp_p2p SET
    p2p_type = "nameofconnection"
    WHERE p2p_type="f79b8d19b8b7dc1b5b357bd518c8d620";

    Let me know if this ends up helping anyone having the same problem

    Plugin Author scribu


    Note that you can find the current hash without doing a query:

    $my_connection_type = p2p_register_connection_type( array(
    ) );
    var_dump( $my_connection_type->name );

    the problem wasn’t that we couldn’t figure out the current hash, the problem I was experiencing was that the hash was changing – I needed to find a listing of orphaned hashes so that I could recover my relations without re-entering them.

    Which I guess brings me to my next question: what paramaters get combined to make the hash? I still don’t know for sure what paramater it was that changed to result in a different hash.

Viewing 15 replies - 1 through 15 (of 35 total)
  • The topic ‘[Plugin: Posts 2 Posts] All existing connection gone?’ is closed to new replies.