News:

Looking for documentation? Take a look on our wiki

Main Menu

Virtuemart and Captcha (registration form)

Started by sohopros, October 27, 2013, 04:04:09 AM

Previous topic - Next topic

sohopros

We are looking for a a captcha solution that is compatible with Virtuemart. We've seen many forum posts recommending EasyCalcCheck Plus. We tried it, and it works fine for the "Ask a question" form, but were not able to display a captcha on the virtuemart user registration page.

Questions:
1 - Are you aware of any captcha plugin that would work with both "Ask a question" and user registration forms?
2 - Is there any way to make EasyCalcCheck Plus work with the virtuemart user registration form?

Thank you,
SOHO Prospecting Team

EasyCalcCheck Plus on JED -> http://extensions.joomla.org/extensions/access-a-security/site-security/captcha/11964

sohopros

Hi again,

We are still unable to make ECC+ captcha work with registration form in VirtueMart.

Anyone knows how can we make it work?

Regards,
SOHO Prospecting Team

coligtho

Quote from: sohopros on November 02, 2013, 00:30:01 AM
Hi again,

We are still unable to make ECC+ captcha work with registration form in VirtueMart.

Anyone knows how can we make it work?

Regards,
SOHO Prospecting Team

Same problem here

coligtho

#3
Because I need to hit the deadline for our project and have no time to search for a better plugin to work with captcha I decided to modify the plugin and combine it with template override:

For the registration form you need to create a file on the template override:

<joomla root>/templates/<yourtemplate>/html/com_virtuemart/user/edit.php

on the form you need to change the attribute id of the form to --> id="userForm2"

and then on the plugin I modified: <joomla root>/plugins/system/easycalccheckplus/easycalccheckplus.php

I tried to modify the function "onUserBeforeSave"

so the function code becomes:

public function onUserBeforeSave($user, $isnew, $new)
    {
        if($this->_load_ecc_check == true)
        {
            if(!empty($isnew))
            {
                $option = JRequest::getWord('option');
                $task = JRequest::getWord('task');

                if(  ($this->params->get('user_reg') AND $option == 'com_users') OR ($this->params->get('communitybuilder') AND $option == 'com_comprofiler'))
                {
                    if(!$this->performChecks())
                    {
                        $url = $this->buildFailedUrl();
                        $this->redirect($url);
                    }
                } elseif( $option=='com_virtuemart' && $task=='saveUser' ){
               
                if(!$this->performChecks()){
                $application = JFactory::getApplication();
               
                $application->enqueueMessage('You failed the spam check. Please try again!', 'error');
                return false;
                }
               
            }
            }
           
        }
    }


And I also modify the loadEcc function on the file within this function try to find the code that says:

elseif($option == 'com_virtuemart')

and change it to:

elseif($option == 'com_virtuemart') // Virtuemart - tested with version 2.0.12f
            {
                if($task == 'askquestion' OR $task == 'mailAskquestion')
                {
                    $this->_extension_info = array('com_virtuemart', '<form[^>]+id="askform".+</form>', '<label>', '<input[^>]*type="submit" name="submit_ask"[^>]*/>', 'mailAskquestion');

                    if($this->params->get('virtuemart') AND ( $view == 'productdetails' AND $task == 'askquestion' ) )
                    {
                        $this->_load_ecc = true;
                    }
                    elseif($this->params->get('virtuemart') AND ($view == 'productdetails' AND $task == 'mailAskquestion') )
                    {
                        $this->_load_ecc_check = true;
                    }
                }
                elseif( $layout == 'edit' OR $task == 'saveUser' OR $task == 'editaddresscheckout' OR $task == 'registercheckoutuser' OR $task == 'savecheckoutuser')
                {
                    $this->_extension_info = array('com_virtuemart', '<form[^>]+id="userForm2".+</form>', '<label>', '<button[^>]*type="submit"[^>]*/>', 'savecheckoutuser');

                    if($this->params->get('virtuemart') AND ( ($layout == 'edit' AND $view == 'user') OR ($view == 'user' AND $task == 'editaddresscheckout') ) )
                    {
                        $this->_load_ecc = true;
                    }
                    elseif($this->params->get('virtuemart') AND $view == 'user' AND ( $task == 'saveUser' OR $task == 'registercheckoutuser' OR $task == 'savecheckoutuser') )
                    {
                        $this->_load_ecc_check = true;
                    }
                }
            }


I know it's not good to break this plugin but I'm desperate to get the project done and it's part of security. I'm not yet sure if how this would affect the way the plugin work as a whole but so far it's working fine on my end just let me know if this works or if you encounter any issues.

jjk

Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations