Monday, 3 October 2011

Add captcha in elgg form

If you need to add captcha  in your form, to follow the below steps

Step 1:

In your form add captcha image and text box
$form_body .= elgg_view('input/captcha');

Step 2:

There two method used to check the capcha

Method 1
Open mod/capcha/start.php and
add your action name in $retrunvalue[] array

function captcha_actionlist_hook($hook, $entity_type, $returnvalue, $params)
    {
        if (!is_array($returnvalue))
            $returnvalue = array();
           
        $returnvalue[] = 'register';
        $returnvalue[] = 'user/requestnewpassword';
        $returnvalue[] = 'your action name';
           
        return $returnvalue;
    }

Method 2

In your module form action file call the captcha_verify_action_hook
captcha_verify_action_hook();

0 comments:

Post a Comment