Adding Google Recaptcha to yclas register form

This post shows minimum changes required in source code to add google recaptcha in the register form of yclass.

Modify themes/reclassifieds3/views/pages/auth/register-form.php to add below code

    <?if (core::config('advertisement.captcha') != FALSE):?>
        <div class="form-group">    
            <?=FORM::label('captcha', __('Captcha'), array('class'=>'col-sm-2 control-label', 'for'=>'captcha'))?>
            <div class="col-md-5 col-sm-6">
                <?if (Core::config('general.recaptcha_active')):?>
                    <?=captcha::image_tag('register_new')?><br />
                    <?= FORM::input('captcha', "", array('class'=>'form-control', 'id' => 'register_new', 'required'))?>

Then modify ./oc/classes/controller/panel/auth.php to make sure that this recaptch check is successful by adding below code,

public function action_register() {
    //if user loged in redirect home
    if (Auth::instance()->logged_in()) {
    } elseif ($this->request->post()) {
       } else {
           Alert::set(Alert::ALERT, __('Captcha is not correct'));

Above code will add recaptcha to user registration for and only if recaptcha is successful then user registrations will be successful.


Subscribe with Valid Email Id to receive updates in Inbox. ( Secured by Google FeedBurner )


Leave a Comment

Android Android Build system Android Commands Android Java Applications Application Libraries Application Stack / User Interface Bash / Shell Scripts Bluetooth driver Cloud Technologies Commands and Packages Compilation Content Management System Core Kernel C Programs Development & Build Development, Debugging and Performance Tools Development Environment Setup Django & REST Api Errors & Failures Git Hardware Platforms HTML JAVA Programs Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Multimedia Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Source Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Web design and development Website Hosting Wordpress Yocto / Bitbake / Openembedded