Relationship Admin Column not showing data
Support › MB Relationships › Relationship Admin Column not showing dataResolved
- This topic has 10 replies, 3 voices, and was last updated 6 years, 4 months ago by mzykin. 
- 
		AuthorPosts
- 
		
			
				
October 1, 2018 at 9:17 AM #11475Max Elman ParticipantUsing the below code, and column headers are created, but no data is showing in the columns. Screenshot of column: https://cl.ly/7cbffe5d6bc1 Screenshot of relationship: https://cl.ly/ac94e6b15fa2 add_action( 'mb_relationships_init', function() { // attorneys to events MB_Relationships_API::register( array( 'id' => 'attorney_to_event', 'from' => array( 'post_type' => 'attorney', 'meta_box' => array( 'title' => 'Linked Events', ), ), 'to' => array( 'post_type' => 'event', 'admin_column' => array( 'position' => 'after title', 'title' => 'Speakers', ), 'meta_box' => array( 'title' => 'Linked Attorney', ), ), ) ); } );October 1, 2018 at 11:55 AM #11478Anh Tran KeymasterHi Max, Your code seems to be correct. Would you mind sending me a temporary admin account to check? October 1, 2018 at 3:35 PM #11482Max Elman ParticipantSent, thanks. October 1, 2018 at 4:40 PM #11483Anh Tran KeymasterJust fixed it on your website and on Github. It's a bug caused by a previous commit for post_type=any.Thanks for letting me know the bug! October 1, 2018 at 9:09 PM #11491Max Elman ParticipantThank you! I was going a little crazy troubleshooting that myself. Two related questions: 1) Why is the code within relationships 'admin_column' and within the full admin columns extension 'admin_columns'? (Difference in 's') 2) Are the full admin column parameters supported within relationships? (before, after, sort, searchable, filterable) October 2, 2018 at 11:17 AM #11494Anh Tran KeymasterHi Max, 1) When we work on admin column for relationship at first, we thought it's a single relationship column, so we use singular form. The Admin Columns extension was made for multiple fields, so it's plural. 2) For relationships: it's not supported. Because the relationships are list of connections and will be unclear when we put something like sorting, search for those connections. June 21, 2019 at 3:00 AM #15033mzykin ParticipantHey guys, Just curious what the fix was? I'm running into the same exact issue. Running MB version 4.18.2 and MB Relationships 1.6.0. Cheers, 
 Mary-AnnJune 22, 2019 at 11:22 AM #15048June 25, 2019 at 1:43 AM #15075mzykin ParticipantHi Anh, Thanks for the response! I took a look at the link and it looks like there's been some changes since that commit. I downloaded the latest stable release (1.6.0) and am still running into the issue. It looks like file referenced above (inc/class-mb-relationships-relationship.php) no longer exists, and has been modified into inc/relationship/admin-columns.php, which is where I think the issue is coming from. June 25, 2019 at 10:49 AM #15082Anh Tran KeymasterYes, the new code has been moved to admin-columns.phpfile but it's still the same. The fix was changing fromget_poststoWP_Query.I've just tested again with the code in the first reply and it seems to work fine. Can you post your code? June 26, 2019 at 7:57 PM #15106mzykin ParticipantHey Anh, Sure thing, here's my code: add_action( 'mb_relationships_init', function() { MB_Relationships_API::register( array( 'id' => 'groups_to_group_sessions', 'from' => array( 'object_type' => 'post', 'post_type' => 'group', 'meta_box' => array( 'title' => 'Group Sessions' ), 'admin_column' => array( 'position' => 'before date', 'title' => 'Group Sessions' ) ), 'to' => array( 'object_type' => 'post', 'post_type' => 'group-session', 'meta_box' => array( 'title' => 'Groups' ), 'admin_column' => array( 'position' => 'after title', 'title' => 'Groups' ) ) ) ); MB_Relationships_API::register( array( 'id' => 'user_to_group', 'from' => array( 'object_type' => 'user', 'admin_column' => array( 'title' => 'Groups' ) ), 'to' => array( 'post_type' => 'group' ) ) ); } );The relationships are being created in the database and the admin columns themselves are appearing, but columns are blank and don't show the connected posts. 
- 
		AuthorPosts
- You must be logged in to reply to this topic.