WordPress.org

Ready to get started?Download WordPress

Forums

Posts 2 Posts
[resolved] Connecting posts within multisite environment (8 posts)

  1. Troy Chaplin
    Member
    Posted 3 years ago #

    Firstly, a big thank you for this fantastic plugin scribu! The ideas and possibilities generated from this will go a long way in increasing front end usability and backend functionality!

    I'm wondering if there's any way, or anything planned for a future release, to be able to create post type connections within a multisite environment?

    I was hoping to find a way to connect a set of entries in one custom post type in one site to a custom post type within another site.

    Thanks,
    Troy

  2. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    It's doable, but it's not even on my todo list at the moment.

  3. Youdaman
    Member
    Posted 3 years ago #

    Just thought I'd add my 2 cents in case anyone else finds this page via googling...

    Awesome plugin scribu, thanks very much :)

    I've discovered that if I do a network activation of the plugin on a multiuser installation the relationships between posts aren't stored -- the default storage for the plugin is in the "wp_p2p" table whereas for multisite it would be in a "wp_X_p2p" table, where X is the site number.

    The quick solution is to enable the plugin on a per-site basis instead of for the entire multisite network.

    The other way is to tweak the plugin to work for multisite, which I might look into now :)

  4. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    And the third way is to use Proper Network Activation ;-)

  5. Youdaman
    Member
    Posted 3 years ago #

    Awesome work (as usual) scribu, thank you very much :)

    I installed Proper Network Activation and it works, but I came across a couple of possible bugs:

    1. upon activation, the notification on the plugin screen says it had been activated for 0/3 of my sites -- I'm guessing this is meant to be an AJAX thing that increments as it activates for each site? The first time I tried I was too quick to activate another plugin and hadn't let it activate for the third site (the p2p table for that site was missng), but then I tried again and it activated correctly (the p2p table was present for that site), but yeah the message still said "0/3" sites. A minor aesthetic issue really :)

    2. I attempted to create another site, but got the following PHP error:

    [17-Feb-2011 02:15:43] PHP Fatal error: Cannot redeclare p2p_get_meta() (previously declared in /var/www/venuepress.com/html/wp-content/plugins/posts-to-posts/storage.php:159) in /var/www/venuepress.com/html/wp-content/plugins/posts-to-posts/storage.php on line 161

    When I went back to my site listing page, the site had indeed been created even though there had been the above error, but of course the p2p functionality didn't work because the p2p table for that new site wasn't created.

    I'll have a look at the code/line mentioned above to see if I can't offer some help -- I really like your plugins!

  6. Youdaman
    Member
    Posted 3 years ago #

    I found a solution -- I changed each instance of "require" to "require_once" in posts-to-posts.php:

    require_once dirname( __FILE__ ) . '/scb/load.php';
    
    function _p2p_init() {
        load_plugin_textdomain( 'posts-to-posts', '', dirname( plugin_basename( __FILE__ ) ) . '/lang' );
    
        require_once dirname( __FILE__ ) . '/storage.php';
        require_once dirname( __FILE__ ) . '/api.php';
        require_once dirname( __FILE__ ) . '/ui/ui.php';
        require_once dirname( __FILE__ ) . '/ui/boxes.php';

    I was then able to create a new site in my network, and everything seemed to be working fine :)

  7. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    1. Fixed now in the development version of Proper Network Activation (1.0.3-alpha).

    2. Yeah, I keep forgetting to do that. Fixed now in the development version of Posts 2 Posts (0.5.2-alpha).

    Thanks for reporting.

  8. Youdaman
    Member
    Posted 3 years ago #

    Excellent! I'm now rocking with your development versions. Thanks :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic