[Elgg 1.8-1.12 & 2.X - 4.X: Captcha] v1.8.0

Release Notes


  • Initial release for Elgg 1.8
  • Wow great, Thank you so much iionly :)

  • Looks pretty professional. Thanks!

  • Bro can't see captcha image in my website. can u help pls ?

  • @Ravish: sorry for the late response. I was on vacation...

    If you can't see the captcha it's quite likely that your site theme or another plugin overrides the corresponding views (register page / lost password page) and therefore the captchas are not shown. You can try to place the captcha plugin below you site theme plugin (if necessary at the bottom). This should help. If it doesn't, then some other plugin / your theme is not compatible with the captcha plugin unfortunately.

  • Where can i download the php_gd library?!


  • @mhauptma: the php_gd library is not an Elgg plugin but an extension / a module of the php script language. Php is part of your server configuration. The php_gd extension is not only necessary for the Captcha plugin but a basic requirement for Elgg itself, too. For example, it's necessary for creation of profile images in the different sizes displayed throughout the site.

    If the gd extension is missing on your server, I would suggest to ask the support of your webhoster to get it installed. I'm afraid, if your support won't do it for you or you have your own server, you will have to do some research and learning on your own about server administration / package installation and php / Apache configuration. An explanation about all that is beyond the scope of the help I can give you here.

  • Hi, great job. Any chance to fix compatibility with sticky_form's ?  Thanks.

  • Hi Ceronor,

    I'm not exactly sure what you mean by "fixing compatibility" with the sticky form. Maybe I've misunderstood your question.

    For example on the registration page the "sticky" form mechanism seems to work for me as intended (tested on Elgg 1.8.9). The content entered into the form fields username, email, display name etc. is still available after a click on the Register button when the registration fails due to missing input or another error. If you leave the registration page and then go back the input is lost - but it is also lost when not using the captcha plugin.

    The exception to the sticky input is indeed the input made to the captcha input field. But this is intentionally. After a registration error a new captcha is loaded. Therefore, keeping the old input would be pointless anyway. The captcha is reloaded to make it a bit harder for spam bots. You wouldn't want them to crack the captcha simply by re-trying to register with the same captcha again and again simply by brute force.

  • hi, thank you ... nice plugin.

    I found a little short when the input text is not the same as the code that appears, why other fields become empty / reseted? and my advice to add captcha appears in the form post when someone makes a post more than once or twice. thanks

  • The captcha is not the same because it would undermine the security mechanism it is to provide to keep for example spammers out. If a spam bot would be allowed to try again and again entering the text of the same captcha it would increase the chances to be successful immensely. Of course, it's rather annoying for a valid user if the already entered info gets resetted, too. If I remember correctly, the other input fields were not affected by loading a new captcha in earlier versions of Elgg. In Elgg 1.8.12 this seems no longer be the case. I don't know right now when this behaviour changed. I've got to look into this issue but I can't promise if there is any solution to allow for reloading only the captcha without resetting the other fields.

  • Works great with my theme too :) Thanks!!

  • Hi, this plugin doesn't work on Google Chrome, the image doesn't display.

    Can you help me?

  • @deuf Thanks for reporting. I don't know when it stopped working (using mainly Firefox myself and I've not tested the Captcha plugin on Chrome since a while).

    Preliminary fix (need to do some more testing but it seems to work fine this way) is to replace the content of mod/captcha/captcha.php with:

     * Elgg captcha plugin graphics file generator
     * @package ElggCaptcha

    $token = get_input('captcha_token');

    // Output captcha
    if ($token)
        // Generate captcha
        $captcha = captcha_generate_captcha($token);

        // Pick a random background image
        $n = rand(1, elgg_get_plugin_setting('captcha_num_bg', 'captcha'));
        $image = imagecreatefromjpeg(elgg_get_plugins_path() . "captcha/backgrounds/bg$n.jpg");

        // Create a colour (black so its not a simple matter of masking out one colour and ocring the rest)
        $colour = imagecolorallocate($image, 0,0,0);

        // Write captcha to image
        //imagestring($image, 5, 30, 4, $captcha, $black);
        imagettftext($image, 30, 0, 10, 30, $colour, elgg_get_plugins_path() . "captcha/fonts/1.ttf", $captcha);

        ob_start(); // start a new output buffer
        $ImageData = ob_get_contents();
        $ImageDataLength = ob_get_length();
        ob_end_clean(); // stop this output buffer

        header("Content-Type: image/jpeg") ;
        header("Content-Length: ".$ImageDataLength);
        header('Cache-Control: no-cache, no-store, must-revalidate');
        header('Pragma: no-cache');
        header('Expires: 0');
        echo $ImageData;

        // Free memory


    Don't forget the exit() at the end. This line is important for the image to show up on Chrome.

  • @deuf Attention: the above code is intented for the Elgg 1.9/1.10 version of the Captcha plugin (I just now noticed you posted in here on the page of the Elgg 1.8 version). The main changes (what is printed in bold above) is basically the same including the exit(); at the end. But you can't simply replace the whole content of the file with the above code because it will surely not work on Elgg 1.8 this way.


  • Category: Authentication
  • License: GNU General Public License (GPL) version 2
  • Updated: 2022-5-28
  • Downloads: 7465
  • Recommendations: 27

Other Projects

View iionly's plugins