User Submitted Posts
[resolved] Adding reCaptcha to submission form (9 posts)

  1. Ayman
    Posted 4 years ago #

    Ok, I'm trying to add the Google reCaptcha into the submission form, but I don't manage to do it... I tried following the Google instructions about it but no luck, as I also tried following some other tutorials and always ending up with no any good result.

    So If anyone have done this before or knows a way to do it... Please share it as that would be greatly appreciated and you will be a life saver.


  2. marcellomagispinetti
    Posted 4 years ago #

    Have you tried to log out before checking reCaptcha?
    Or to uncheck the option "Hide the CAPTCHA for registered users..." in 'General Options'?

  3. Ayman
    Posted 4 years ago #

    Hi marcellomagispinetti, thanks for answering.

    I already tried using the plugin WP-reCAPTCHA but the reCaptcha didn't appear on the form, so I tried to insert it manually in the files of the plugin but I didn't really manage... However to answer your questions:

    Have you tried to log out before checking reCaptcha?

    Yes I did try as a user (Admin) and as a visitor but always the same result.

    Or to uncheck the option "Hide the CAPTCHA for registered users..." in 'General Options'?

    I have also tried that but always with no luck.

    Is there another Plugin/Manual way do it?

  4. pete101
    Posted 4 years ago #

    i'm trying to do the same thing as well.

    is there a stand alone plugin which adds re-captcha to any page?

    i cant find one.

    it's very frustrating

  5. montselobos
    Posted 3 years ago #

    I have the same problem. Did any of you find a solution or alternative?

  6. Jorge
    Posted 3 years ago #

    I'm new to WordPress, so there might be a better solution, and this is what I did...

    1) download the plugin Really Simple Captcha: http://wordpress.org/extend/plugins/really-simple-captcha

    2) install and activate

    3) In admin go to Plugins -> Editor then select "User Submitted Posts" from the drop down (top right of web page)

    4) Click on "user-submitted-posts/user-submitted-posts.php"

    5) find "function checkForPublicSubmission() {" and enter the following code:

    if (isset($_POST['user-submitted-post']) && ! empty($_POST['user-submitted-post'])) {
    $captcha_instance = new ReallySimpleCaptcha();
    $correct = $captcha_instance->check(  $_POST['prefix'], $_POST['answer'] );
    if ($correct != 1) {
    $redirect = add_query_arg( array( 'submission-error' => '1' ), $redirect );
    $captcha_instance->remove( $prefix );
    wp_redirect( $redirect );

    6) save and then click on "user-submitted-posts/views/submission-form.php"

    7) under "<form id="usp_form" method="post" enctype="multipart/form-data" action="">" add the following code

    	$captcha_instance = new ReallySimpleCaptcha();
    	$prefix = mt_rand();
    	$word = $captcha_instance->generate_random_word();
    	$captcha_instance->generate_image( $prefix, $word );
    <input class="usp_input" type="text" name="prefix" id="prefix" value="<?php echo $prefix;?>" hidden />
    <input class="usp_input" type="text" name="answer" id="answer" value="" />
    <img src="wp-content/plugins/really-simple-captcha/tmp/<?php echo $prefix ?>.png"/>

    8) change <?php if($_GET['success'] == '1'... }?> TO

    <?php if($_GET['success'] == '1') { ?>
    		<div id="usp_success_message"><?php _e('Submission received!'); ?></div>
    		<?php } else if($_GET['submission-error'] == '1') { ?>
    		<div> try again </div>
    		<?php } ?>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum's parser.]

  7. Jorge
    Posted 3 years ago #

    oh I hardcoded the plugin directory and changed it to what was in this post How to get a plugin path

  8. Jeff Starr
    Plugin Author

    Posted 3 years ago #

    I've added a simple (and customizable) captcha to the latest version of the plugin, along with additional anti-spam measures. Please check out the new features in version 20121120 :)

  9. mastermachine
    Posted 3 years ago #

    Is there any way to add google captcha to that form or whatever is set as default by WordPress?
    Or at least to add some tutorial on how to do it onourselves

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • User Submitted Posts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic