WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: User Submitted Posts] Adding reCaptcha to submission form

[Resolved] [Plugin: User Submitted Posts] Adding reCaptcha to submission form

Viewing 8 replies - 1 through 8 (of 8 total)
  • Have you tried to log out before checking reCaptcha?
    Or to uncheck the option “Hide the CAPTCHA for registered users…” in ‘General Options’?

    Ayman

    @aymanalzarrad

    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?

    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

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

    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 );
    exit();
    }
    }

    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

    <?php
    	$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.]

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

    Plugin Author Jeff Starr

    @specialk

    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 🙂

    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

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] [Plugin: User Submitted Posts] Adding reCaptcha to submission form’ is closed to new replies.