Plugin Author
scribu
(@scribu)
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().
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
(@scribu)
So what exactly happens when you start typing in one of the other boxes?
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
(@scribu)
That means the AJAX request is throwing some PHP error.
You’ll need to use Firebug or Webkit console to see what it is.
Uncaught TypeError: Cannot read property ‘rows’ of null
Box.js line 171
Plugin Author
scribu
(@scribu)
Ok, thanks, but what does the AJAX response look like?
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
(@scribu)
Not really.
If you download the development version (1.0.1-alpha), you should see a ‘Malformed response’ error in the console. Please post it in it’s entirety.
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
(@scribu)
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.
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
(@scribu)
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.
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
(@scribu)
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 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.