• Tried using this with an acf_form that created a new post, using the method to put it inside the acf_form() function. It worked, but you have to submit the form once before you can fill out the rest of the form. This actually creates blank posts!

    And configuration is just very convoluted.

    Some other reviews say it worked out of the box. What? Not for me. But I’m not using it in a field group, because it should only appear for guests. Oh well.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Irvin Lim

    (@irvinlim)

    Hi there, sorry to hear that you’re having trouble.

    Could I take a look at how you’re creating the form with acf_form()? If you are not using field groups, then I suppose you are using acf_add_local_field() to register your fields?

    Thread Starter radgh

    (@radgh)

    Below is the ACF form I used prior to leaving my comment. When viewing the form on the front-end, only the recaptcha was visible until you tick the box and then submit, then the full form appears. Doing this created an empty “open_house” post. And actually for some reason, it created two at the exact same time.

    Submitting the full form after the recaptcha worked, though.

    	$args = array(
    		'post_id'		=> 'new_post',
    		'post_title'	=> false,
    		'post_content'	=> false,
    		'new_post'		=> array(
    			'post_type'		=> 'open_house',
    			'post_status'	=> 'publish'
    		),
    	    'field_groups' => array(
                'group_59bae2a7e074a' // Open House Details
    		),
                'fields' => array( 'field_59c3114cf1839' ), // Recaptcha field from an active field group
                'recaptcha' => 'true',
    	    'submit_value'    => 'Add Listing',
    	    'updated_message' => 'Listing created successfully',
    	    'return'          => add_query_arg( array( 'h_action' => 'edit', 'h_id' => '%post_id%', 'updated' => 1), get_permalink() ),
    	);
    	acf_form($args);

    Later on, I tried a second time with a different ACF form with an inline ReCAPTCHA field. This one showed the entire form along with the recaptcha. This was for an event post type with different fields.

    However, when submitting this form it also created empty events. This also made it so ajax validation didn’t work – if you have an error it goes to a new page and gives you a screen of error messages in a wp_die() dialog. Without the recaptcha field, trying to submit with errors would highlight the bad fields in red without reloading the page.

    	$args = array(
    		'post_id'		=> 'new_post',
    		'post_title'	=> true,
    		'post_content'	=> false,
    		'new_post'		=> array(
    			'post_type'		=> 'event',
    			'post_status'	=> 'pending'
    		),
    		'field_groups' => array(
    			'group_59c2a8fd60859' // Event Details
    		),
    		'submit_value'    => 'Add Event',
    		'updated_message' => 'Event created successfully',
    	);
    	
    	acf_form($args);

    Note for the second one: I added the recaptcha field to the field group seen in that code. I added the keys appropriately, and made the recaptcha required. I also turned on the switch at the bottom of the ACF settings that said it requires the recaptcha field to submit (I don’t remember the exact verbiage of that checkbox though).

    Hope that helps.

    Plugin Author Irvin Lim

    (@irvinlim)

    Hi, really sorry for replying to this so late.

    I noticed for the first example you gave, you used 'recaptcha' => 'true' instead of 'recaptcha' => true – which might be one source of the problem. I will be allowing the string as well, which will be released in the next patch.

    I might also need more details about the field group in the first code example. I’m unable to reproduce any of such issues where you post is empty – perhaps it’s because you set post_title and post_content to false, that’s why you’re not seeing any content in the editor? Are your custom fields values being set?

    If the AJAX validation didn’t work in the second example, and instead you’re seeing a wp_die() screen, it’s probably because something is calling wp_die() in the validate_value hook for one of your fields, or there might be a JavaScript error.

    Hope that I wasn’t too late to help!

    Thread Starter radgh

    (@radgh)

    Oh sorry I’m sure I tried using it as a boolean before at some point as I tried many combinations of options when I was testing. In any case, once I got rid of the plugin all of the issues I was facing disappeared and the website has launched with an alternative to block spam.

    Thanks for the effort anyway!

    Plugin Author Irvin Lim

    (@irvinlim)

    Sorry to hear it didn’t work out for you. 🙁

    Anyhow, glad that you fixed all the problems in the end!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Kinda works’ is closed to new replies.