Home Forums Front-end Issues acf_form filter field_groups for some users ?


acf_form filter field_groups for some users ?

  • Hello,

    I’m creating front end form. I have 2 user types: 1 – clients, 2 – authors.
    Bouth of them should be able to edit and publish ( save as draft ) new posts, but Author’s can specify for wich client is post ment.

    I’v added field group with only 1 field – client select, but on front end form it displays for both: clients and authors, but need’s to be only for athors.

    So the question is how to manage to filter groups wich should and shouldn’t be loaded to acf_form() ?

    my code right now is:

    acf_form( array(
    	'post_id'	=> 'new_post',
    	'post_title'	=> true,
    	'post_content'	=> true
    ) );

    I’v looked the code and there’s fiering only acf/location/rule_match/post_type filter with no data about field_group ( so i can’t exclude them iven by id ).. any help!

  • Found that on field_group creation i can add an logic, so it took me just creating “and current user type == ‘admin’ || current user type == ‘author'” so, no php code eneeded for that, it’s making from the conditional logic fields.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘acf_form filter field_groups for some users ?’ is closed to new replies.