Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Reload captcha image issues

luasoftluasoft New
edited February 2015 in Vanilla 2.0 - 2.8

i'm making a captcha plugin for integration into New Discussion, Edit Discussion, Post Comment forms.
i'm having problem loading captcha image when post data failed (captcha session value is always changing after every form is clicked)
default vanilla forums using ajax to save disucssion, comment.

Currently, i have two temporary solutions:

Solution 1: Add script and always reload captcha image after every form is clicked, like this:

    jQuery(document).ready(function($) {
        $('.DiscussionButton').on('click',function() {
            setTimeout(function() {
            }, 500);

Solution 2: Modify javascript code of vanilla forums (\applications\vanilla\js\post.js)

// Hijack discussion form button clicks
$('#DiscussionForm :submit').live('click', function() {
         success: function(json) {
            if (json.FormSaved == false) {

               ReloadCaptchaImage(); // my function

               json.ErrorMessages = null;

i don't want to always load captcha image (Solution 1),
and I don't want to modify javascript code of vanilla (Solution 2)

Are there any other solutions better?




  • Options
    R_JR_J Ex-Fanboy Munich Admin

    definitions['LastCommentID'] changes after a successful save. Maybe that helps you. You could get the original value on load and compare after each click if it has changed and decide based on that fact, if you load a new captcha.

Sign In or Register to comment.