Adding a Custom Field to be used by Posts 2 Posts

Not sure if you really need to use the custom admin boxes, unless you need to customize labels, etc…

<?php
function my_connection_types() {
    // Make sure the Posts 2 Posts plugin is active.
    if ( !function_exists( 'p2p_register_connection_type' ) )
        return;

    p2p_register_connection_type( array(
        'name' => 'cpt1_to_cpt2',
        'from' => 'cpt1',
        'to' => 'cpt2',
            'admin_box' => 'from',
    'fields' => array(
        'field_name' => 'field_title',
        'field_name2' => 'field_title2'
    )
    ) );
}
add_action( 'wp_loaded', 'my_connection_types' );
?>

And if you need to add custom labels, you can just extend the registration array to include:

 'from_labels' => array(
      'singular_name' => __( 'Person', 'my-textdomain' ),
      'search_items' => __( 'Search people', 'my-textdomain' ),
      'not_found' => __( 'No people found.', 'my-textdomain' ),
      'create' => __( 'Create Connections', 'my-textdomain' ),
  ),

Then, to update a form field in Gravity Forms based on the connection, you can use the gform_pre_render filter to populate your field; something like:

http://www.gravityhelp.com/documentation/page/Dynamically_Populating_Drop_Down_Fields
http://www.gravityhelp.com/documentation/page/Gform_pre_render

Short on time, but if I get a chance I’ll update with a more specific Posts2Posts example. I’m sure if you dig into his admin box class a bit, you’ll be able to combine it with the filter above to get the results your looking for.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)