wp-posts-to-posts icon indicating copy to clipboard operation
wp-posts-to-posts copied to clipboard

Post 2 post integrate with plugin

Open padalec opened this issue 11 years ago • 3 comments

Hi there, I install your plugin via composer and in my plugin base file I add this line:

require_once 'vendor/autoload.php';

next I register custom post types (instructors and classes) and connection between custom post types:

function my_connection_types() {
        $settings = array(
            'name'      => 'instructor_2_classes',
            'from'      => 'instructors',
            'to'        => 'classes',
            'admin_box' => array(
                'show'    => 'any',
                'context' => 'side'
            ),
        );
        p2p_register_connection_type( $settings );
    }
    add_action( 'p2p_init', 'my_connection_types' );

but this doesn't work. When I go to phpMyAdmin I don't see any new tables. So I try to install p2p plugin via wordpress plugin page and when I activate p2p I got this fatal error:

 Fatal error: Cannot redeclare scb_init() (previously declared in F:\wamp\www\igniter\wp-content\plugins\posts-to-posts\scb\load.php:89) in F:\wamp\www\igniter\wp-content\plugins\schedule\vendor\scribu\scb-framework\load-composer.php on line 12

Regards.

padalec avatar Mar 19 '15 15:03 padalec

You should try integrating the P2P library, not the whole plugin.

scribu avatar Mar 20 '15 17:03 scribu

Unfortunately, simply doing require 'vendor/autoload.php'; is not going to work reliably, unless you have your whole site managed using Composer or you do the same gymnastics for loading scbFramework that the P2P plugin does.

scribu avatar Mar 20 '15 17:03 scribu

Hi there, thanks for your replay that was what I need. Regards

padalec avatar Mar 23 '15 12:03 padalec