Captcha validation is not correct for creating new thread

stefanstp

Member
Affected version
2.2.9
We activated for guests to post new threads before login or registering. But after activation Captcha validation wasn't working. Because in the code "src/XF/Pub/Controller/Forum.php" file and "actionPostThread" method line "878" should check only "$this->captchaIsValid" or not. But it also checks user id for guest. That's why it's not working the correct way.
Code:
if (!$this->captchaIsValid() && !$isPreRegThread)
{
    return $this->error(\XF::phrase('did_not_complete_the_captcha_verification_properly'));
}

Should be replaced with:
Code:
if (!$this->captchaIsValid())
{
    return $this->error(\XF::phrase('did_not_complete_the_captcha_verification_properly'));
}

Notice: $isPreRegThread variable coming from "src/XF/Entity/Forum.php" file and "canCreateThreadPreReg" method.
Code:
if (\XF::visitor()->user_id || $this->canCreateThread())
{
    return false;
}
There for guests, it's always false and captcha validation is not working.

We are using Xenforo version v2.2.9.
 
Top