Forums » Recaptcha disappears from Contribution form

RSS feed for this topic

Info

  1. I just noticed that the ReCAPTcha boxes are not displaying on the Contribution page on Internet Explorer 8. The boxes do appear on Firefox, Safari and Opera.

    https://wbexhibit.otis.edu/contribution

    The problem might be happening since the page is on HTTPS. From what I've researched, the function recaptcha_get_html() has the parameter $use_ssl. The default is false; I cannot figure out where to set this value to true.

    Of course, something else entirely could be causing the problem. Any ideas?

  2. Yes, I believe serving it on https is causing the trouble. In IE, when navigating to the form, were you asked if you wanted to view content that was only delivered securely?

    When clicking yes, no ReCaptcha box. When clicking no, the ReCaptcha appears. It's there, more just the way that IE reads and responds to the page.

  3. You are correct. If I say no, the ReCaptcha boxes do appear.

    I finally found the right file to turn the ssl on: \application\libraries\Zend\Service\ReCaptcha.php

    Replace false to true at

    protected $_params = array(
    'ssl' => true,
  4. I'm having the same issue with the commenting plugin, and the recaptcha prompting a message in ie about only viewing content delivered securely. I found the file that's mentioned above, but before making a change to the core of Omeka, I was wondering if there's any way to copy this file to my theme and update it from there? If not I can always make note of the change, so I can redo it after any future upgrades to Omeka.

  5. The file is a bit too deep-down to change by moving it to the theme. It's actually in the Zend framework that Omeka is built on top of, so you could say it is in the "inner core" of Omeka. I'll give the plugins a look to see if the issue can be fixed in that (much more sensical) way.

  6. I'm flailing in the dark a little bit here, since I don't have IE8, nor a site on https, and the Zend depths are new territory for me. But, this might work -- if you could give it a try, I'd really appreciate it.

    In Commenting/CommentForm.php, add a line in the block of code that starts about line 14 so that this:

    //assume registered users are trusted and don't make them play recaptcha
            if(!$user && get_option('recaptcha_public_key') && get_option('recaptcha_private_key')) {
                $this->addElement('captcha', 'captcha',  array(
                    'class' => 'hidden',
                    'label' => "Please verify you're a human",
                    'captcha' => array(
                        'captcha' => 'ReCaptcha',
                        'pubkey' => get_option('recaptcha_public_key'),
                        'privkey' => get_option('recaptcha_private_key'),
                    )
                ));
            }

    looks like this:

    //assume registered users are trusted and don't make them play recaptcha
            if(!$user && get_option('recaptcha_public_key') && get_option('recaptcha_private_key')) {
                $this->addElement('captcha', 'captcha',  array(
                    'class' => 'hidden',
                    'label' => "Please verify you're a human",
                    'captcha' => array(
                        'captcha' => 'ReCaptcha',
                        'pubkey' => get_option('recaptcha_public_key'),
                        'privkey' => get_option('recaptcha_private_key'),
                        'ssl' => true
                    )
                ));
            }

    The only addition is the line that is added at line 22, where 'ssl'=> true is added to the array.

    I'll see if I can find a person around here with a site that will help get a better test in place.

  7. The fix you suggested works. I'll let you know if I encounter any issues as a result. Thanks.

    This is what my CommentForm.php file looks like:

    //assume registered users are trusted and don't make them play recaptcha
            if(!$user) {
                $this->addElement('captcha', 'captcha',  array(
                    'class' => 'hidden',
                    'label' => "Please verify you're a human",
                	'captcha' => array(
                        'captcha' => 'ReCaptcha',
                        'pubkey' => get_option('recaptcha_public_key'),
                        'privkey' => get_option('recaptcha_private_key'),
    			    'ssl' => true
                    )
                ));
    
            }
  8. Since the last post, I've also added 'theme'=>'clean' under the 'ssl' => true, so that I have a recaptcha that better matches my site's style on the comment form.

    However, I'm now looking at the recaptcha on the contribution form, and trying to figure out what to modify in order to change it's theme and its ssl status. I could change the inner core file referenced above, but I was hoping to do it within the plugin.

    It seems that the relevant file is views/public/contribution/contribute.php and the line of code is <?php if(isset($captchaScript)): ?><div id="captcha" class="inputs"><?php echo $captchaScript; ?></div><?php endif; ?>. However, I'm not sure how to add the theme and ssl information to this line. Any suggestions would be greatly appreciated.

  9. You have to move to the controller, which sets up the data that is passed to the view. The controller you need is in Contribution/controllers/ContributionController.php

    (More about controllers, models, and views here, if you are interested. It might help guide you to where to look for things in general.)

    Change this method:

    protected function _setupCaptcha()
        {
            return Omeka_Captcha::getCaptcha();
        }

    to:

    protected function _setupCaptcha()
        {
        	$captcha = Omeka_Captcha::getCaptcha();
        	$captcha->setOptions(array('theme'=>'clean'));
            return $captcha;
        }

    You might be able to set the ssl info the same way (haven't tested that). A later version of the Commenting plugin will be more consistent with Contribution and use Omeka_Captcha the same way.

    HTH

  10. Awesome. Thanks!

Reply

You must log in to post.