WordPress.org

Support

Support » Plugins and Hacks » [Plugin: SI CAPTCHA Anti-Spam] SI CAPTCHA and MU domains

[Plugin: SI CAPTCHA Anti-Spam] SI CAPTCHA and MU domains

Viewing 9 replies - 1 through 9 (of 9 total)
  • Ron Rennick

    @wpmuguru

    MultiSite Guru

    I haven’t used SI Captcha & I haven’t heard of anyone having that issue. If you can provide more details I might be able to point you in the right direction.

    Plugin Author Mike Challis

    @mikechallis

    A URL to a page with the problem would be helpful.

    I’ve set up two test blogs to illustrate the problem. The first is not set up in “MU Domain Mapping”, the second is:

    http://test.aiblog.co.uk/
    http://testblog.amazinginternet.com/ (http://test2.aiblog.co.uk/ is the true blog address)

    Posting comments works on the first blog but not on the second. The error given on the failure is:

    “ERROR: Could not read CAPTCHA cookie. Make sure you have cookies enabled and not blocking in your web browser settings. Or another plugin is conflicting. See plugin FAQ.”

    Thanks for any pointers that anyone can give on how to resolve this.

    Ronny

    The following changed fixed the problem for me. Not saying it’s correct but it worked for my scenario:

    $ cvs diff -u si-captcha.php
    Index: si-captcha.php
    ===================================================================
    RCS file: /stor/cvsroot/aiblog.co.uk/htdocs/wp-content/plugins/si-captcha-for-wordpress/si-captcha.php,v
    retrieving revision 1.1.1.1
    diff -u -r1.1.1.1 si-captcha.php
    --- si-captcha.php      14 Mar 2011 11:48:14 -0000      1.1.1.1
    +++ si-captcha.php      15 Mar 2011 17:58:34 -0000
    @@ -1337,7 +1337,7 @@
    
       $url  = WP_PLUGIN_URL . $si_dir;
    
    -  if ($site_uri['host'] == $home_uri['host']) {
    +  if ($site_uri['host'] != $home_uri['host']) {
           $url = WP_PLUGIN_URL . $si_dir;
           if ($wpmu == 1)
                $url = get_option('siteurl') . '/' . MUPLUGINDIR . $si_dir;
    @@ -1351,7 +1351,6 @@
       if ( getenv('HTTPS') == 'on' ) {
           $url = preg_replace('|http://|', 'https://', $url);
       }
    -
       return $url;
     }
    
    @@ -1483,4 +1482,4 @@
          register_uninstall_hook(__FILE__, 'si_captcha_unset_options');
     }
    
    -?>
    \ No newline at end of file
    +?>

    Damn, correction to last. It appeared to fix my test scenario. Problem remains. Sigh. Looking at this again tomorrow after after some sleep.

    Ronny

    The problem seems to be that the CAPTCHA is being called on the wrong domain when at a domain-mapped blog.

    In the end I’ve changed the function get_captcha_url_si to return the following which I’ll run for a few days to verify it works:

    $url = (is_ssl() ? 'https://' : 'http://') . $current_blog->domain . $current_blog->path . ($wpmu == 1 ? MUPLUGINDIR : PLUGINDIR) . $si_dir;
    
    return $url;

    You need to add $current_blog to the global call at the top of the function too.

    This works for me on both mapped and non-mapped blogs. Couldn’t say how it will fare with blogs on a non-root path.

    Plugin Author Mike Challis

    @mikechallis

    I have a standard 1 domain blog.

    I think this code will work. But since I do not have all these variant blogs installed it is hard to test.

    if ( isset( $current_blog ) && !empty( $current_blog->domain ) && !empty( $current_blog->path ) )
        $url = (is_ssl() ? 'https://' : 'http://') . $current_blog->domain . $current_blog->path . ($wpmu == 1 ? MUPLUGINDIR : PLUGINDIR) . $si_dir;
    Plugin Author Mike Challis

    @mikechallis

    I added this code to the trunk download. Hopefully it s correct.

    Hi Mike.

    I can confirm that your fix works on my set up.

    Ronny

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: SI CAPTCHA Anti-Spam] SI CAPTCHA and MU domains’ is closed to new replies.