pods icon indicating copy to clipboard operation
pods copied to clipboard

When adding custom groups of fields with pods_group_add(), don't show those fields in other groups (if already in a real group)

Open andrepetrini opened this issue 2 years ago • 5 comments

Description

Hi, I already have a lot of PODs, and I used to group them with code: `function my_metaboxes ( $type, $name ) { pods_group_add( 'campaign', 'Campanha', 'images,video1' ); pods_group_add( 'campaign', 'Mais Vídeos', 'video2,video3,video4,video5,video6' ); pods_group_add( 'campaign', 'Créditos', 'agency,brand,sector,creatives' ); pods_group_add( 'campaign', 'Produção', 'production_company,film_director,photographer,illustrator' ); pods_group_add( 'campaign', 'Prêmios', 'award_tracking' ); pods_group_add( 'campaign', 'Outros', 'overview,collections,public_awareness,user_playlist' ); pods_group_add( 'campaign', 'Antigo (não usar)', 'campaign_video,download_link' );

} add_action( 'pods_meta_groups', 'my_metaboxes', 10, 2 );`

But when I updated to the 2.8 version, this code broke the admin view because it introduced the new groups. I deleted the code and the admin is back to normal. Problem is that I can't manage the groups from my existing pods, since I can't move an existing field to new groups. So, in order to have the groups as I had before, I would need to create all the fields once again. We should have a way to create a new group and move an existing field there. If there are issues with dragging from a group to another, maybe it could be with a dropdown inside the Edit Field? Thank you. Best

Version

2.8.5

Testing Instructions

No response

Screenshots / Screencast

No response

Possible Workaround

No response

Site Health Information

No response

Pods Package

No response

andrepetrini avatar Nov 18 '21 20:11 andrepetrini

@sc0ttkclark Another user reported the same issue: https://wordpress.org/support/topic/pods_group_add-is-broken-now/

JoryHogeveen avatar Nov 19 '21 11:11 JoryHogeveen

We'll address moving fields to a different group as part of #6183

I'll look into the issue with using pods_group_add() and having those fields not show through other groups. For now, one workaround solution that seems to work for another person is to edit those fields in Pods to hide them from the UI. Then keep your pods_group_add() code. It should automatically handle show/hide so that your custom group will show the field but the normal group will hide it.

Other pods_group_add() issues known have been addressed in Pods 2.8.6

sc0ttkclark avatar Nov 30 '21 02:11 sc0ttkclark

I don't know if this introduced a new bug, but right now in 2.8.7, any field added through pods_group_add() is being rendered as a text field despite the field type being set to something total different.

khill07 avatar Dec 02 '21 23:12 khill07

Hey @khill07 , I had the same problem. Removing the pods_group_add() fixed the issue for now, but obviously removed the groups too. Waiting for the new update here to have groups organized again.

andrepetrini avatar Dec 03 '21 14:12 andrepetrini

Why in the world does this just keep getting pushed. I haven't been able to upgrade for 5 months now.

khill07 avatar May 16 '22 15:05 khill07

Can this be closed as done in https://github.com/pods-framework/pods/pull/6456 ?

BrookeDot avatar Oct 15 '23 01:10 BrookeDot

I'm wondering what the use cases are for adding fields to groups using pods_group_add that couldn't be covered by Pods configs now -- https://docs.pods.io/code/registering-configurations/

I don't know if the group handling is resolved here by manually grouping with this function for a DB-based config, but the file-based configs do work well.

sc0ttkclark avatar Oct 15 '23 03:10 sc0ttkclark

I have a fix that can address this, it helps to avoid duplicate fields in general when using custom non DB-based configs.

sc0ttkclark avatar Oct 15 '23 16:10 sc0ttkclark