I might be missing the obvious here, but I just don’t see it.
I’m using Advanced Post Creation to make a frontend post creation form available to registered users.
I can’t figure out how to let the registered user make a decision (by radio buttons or checkbox field) on the frontend form to allow comments, or not.
How do I target the WP native allow comments option?
You can use the gform_advancedpostcreation_post filter to set the comment_status property.
Sorry I can’t follow. I’m not sure if we’re talking about the same goal.
I’d like to let the individual user decide if other users can comment on his specific post.
I don’t want to have a filter applied to all form submissions.
As I mentioned in the initial post, I’d like to let the user check a box or a radio button on the frontend form that will target the “allow comments” option of Wordpress. Every user should have this option on every individual post they create.
Maybe that’s what you were suggesting, but I don’t understand the “how”.
You would check the field value via the filter. For example, this would apply to form ID 1, and would set the comment_status to open if the first input of checkbox field ID 2 is checked.
add_filter( 'gform_advancedpostcreation_post_1', function ( $post, $feed, $entry, $form){
$post['comment_status'] = rgar( $entry, '2.1' ) ? 'open' : 'closed';
return $post;
} , 10, 4 );