Title: [Plugin: Posts 2 Posts] Widget in admin not finding connection
Last modified: August 20, 2016

---

# [Plugin: Posts 2 Posts] Widget in admin not finding connection

 *  Resolved [salocined](https://wordpress.org/support/users/salocined/)
 * (@salocined)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/)
 * I have 3 connections widget box for my post in admin.
 * First connection box works perfectly when typing first few letter (automatically
   finds related) or when using the View all link.
 * My other 2 widget box don’t work when starting typing, only the View all links
   will display the full list of connected post.
 * any idea?
 * thx
    s
 * [http://wordpress.org/extend/plugins/posts-to-posts/](http://wordpress.org/extend/plugins/posts-to-posts/)

Viewing 15 replies - 1 through 15 (of 30 total)

1 [2](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/page/2/?output_format=md)

 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/#post-2397324)
 * To avoid confusion, those are called metaboxes and they seem to work fine, even
   when there are multiple.
 * Please paste the calls to p2p_register_connection_type().
 *  Thread Starter [salocined](https://wordpress.org/support/users/salocined/)
 * (@salocined)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/#post-2397325)
 * Sorry for the confusion of metaboxes.
 * My register_connection is as follow
 *     ```
       function my_connection_types() {
           if ( !function_exists('p2p_register_connection_type') )
               return;
   
          p2p_register_connection_type(array(
         		'id' => 'posts_to_offer',
         		'from' => 'post',
         		'to' => 'offer',
             'reciprocal' => true
         	)); 
   
           p2p_register_connection_type(array(
         		'id' => 'company_to_offer',
         		'from' => 'company',
         		'to' => 'offer',
             'reciprocal' => true
         	)); 
   
           p2p_register_connection_type(array(
         		'id' => 'company_to_post',
         		'from' => 'company',
         		'to' => 'post',
             'reciprocal' => true
         	)); 
   
           p2p_register_connection_type(array(
         		'id' => 'company_to_destination',
         		'from' => 'company',
         		'to' => 'destination',
             'reciprocal' => true
         	)); 
   
           p2p_register_connection_type(array(
         		'id' => 'destination_to_offer',
         		'from' => 'destination',
         		'to' => 'offer',
             'reciprocal' => true
         	));
       }
       ```
   
 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/#post-2397329)
 * So what exactly happens when you start typing in one of the other boxes?
 *  Thread Starter [salocined](https://wordpress.org/support/users/salocined/)
 * (@salocined)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/#post-2397330)
 * The png circle turns but nothing appears like in the first box.
    When clicking
   View all, the right connected items appear. Same happen for box 2 and 3 weird.
 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/#post-2397333)
 * That means the AJAX request is throwing some PHP error.
 * You’ll need to use Firebug or Webkit console to see what it is.
 *  Thread Starter [salocined](https://wordpress.org/support/users/salocined/)
 * (@salocined)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/#post-2397335)
 * Uncaught TypeError: Cannot read property ‘rows’ of null
    Box.js line 171
 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/#post-2397349)
 * Ok, thanks, but what does the AJAX response look like?
 *  Thread Starter [salocined](https://wordpress.org/support/users/salocined/)
 * (@salocined)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/#post-2397352)
 * Uncaught TypeError: Cannot read property ‘rows’ of null
    jQuery.each.prototype.
   update_rowsbox.js:171 (anonymous function)box.js:236 f.extend._Deferred.e.resolveWithload-
   scripts.php:16 wload-scripts.php:18 f.support.ajax.f.ajaxTransport.send.dload-
   scripts.php:18
 * Better?
 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/#post-2397366)
 * Not really.
 * If you download the [development version](http://downloads.wordpress.org/plugin/posts-to-posts.zip)(
   1.0.1-alpha), you should see a ‘Malformed response’ error in the console. Please
   post it in it’s entirety.
 *  Thread Starter [salocined](https://wordpress.org/support/users/salocined/)
 * (@salocined)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/#post-2397367)
 * Thanks Scribu, I am not getting anything else than the Uncaught as above.
 * Interesting development, when logged as an admin ALL 3 boxes are working perfectly.
   
   When logged in as a visitor or in my case, a client, only the first box works.
 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/#post-2397384)
 * I think I found the problem: those faulty boxes shouldn’t show up at all for 
   clients, since they don’t seem to have the required capability.
 * Updated the [development version](http://downloads.wordpress.org/plugin/posts-to-posts.zip).
 *  Thread Starter [salocined](https://wordpress.org/support/users/salocined/)
 * (@salocined)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/#post-2397386)
 * ok cool, they did disappear with the new dev version
    BUT how do I enable them
   for the client user type? I still have the 1st box appearing (post).
 * The 2 other boxes are using custom post types
 * sorry to be a pain
 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/#post-2397389)
 * It depends on how you defined the other post types.
 * For example, for the ‘posts_to_offer’ connection type, see what this line outputs:
 * `var_dump( get_post_type_object( 'offer' )->cap->edit_posts );`
 * Put it after the `p2p_register_connection_type()` calls.
 * That will be the capability that the client needs to have to see the box.
 * There are several plugins for managing capabilities via the wp admin.
 *  Thread Starter [salocined](https://wordpress.org/support/users/salocined/)
 * (@salocined)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/#post-2397395)
 * I run Adminize on the site for controlling capabilities.
    THe var_dump returns
   a NULL for admin or client. Also I noticed with the latest dev version sent, 
   that ADMINS cant see all 3 boxes now.. 🙁
 * I might just revert to the original stable version for now…
 *  Plugin Author [scribu](https://wordpress.org/support/users/scribu/)
 * (@scribu)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/#post-2397401)
 * Strange.
 * Try adding the following code somewhere:
 *     ```
       function debug_post_type() {
       	$post_type = 'offer';
   
       	echo '<pre>' . var_export( get_post_type_object( $post_type ), true ) . '</pre>';
       }
       add_action( 'admin_notices', 'debug_post_type' );
       ```
   
 * Use [http://pastebin.com](http://pastebin.com) for pasting the result, since 
   it will likely be large.
 * If you get null, it means you don’t actually have the ‘offer’ post type defined.

Viewing 15 replies - 1 through 15 (of 30 total)

1 [2](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/page/2/?output_format=md)

The topic ‘[Plugin: Posts 2 Posts] Widget in admin not finding connection’ is closed
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/posts-to-posts_7a8e9d.svg)
 * [Posts 2 Posts](https://wordpress.org/plugins/posts-to-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/posts-to-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/posts-to-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/posts-to-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/posts-to-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/posts-to-posts/reviews/)

 * 30 replies
 * 2 participants
 * Last reply from: [salocined](https://wordpress.org/support/users/salocined/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-posts-2-posts-widget-in-admin-not-finding-connection/page/2/#post-2397553)
 * Status: resolved