When the "Use captcha for anonymous posts" setting is unchecked, captcha is not showing on feedback form, as it is treated as an anonymous post.
I could just fix this by checking if the user is anonymous and, if it is, just avoid calling the qa_user_captcha_reason(). The thing is that I would be getting part of the logic from that function out of the function. So I'd rather keep the logic (the if statement) in the function and just send the function the actual data to process it.
In other words, I think it is better to change the signature from:
function qa_user_captcha_reason($userlevel = null)
to:
function qa_user_captcha_reason($userlevel = null, $showCaptchaIfAnonymous = true)
This way the
if (qa_opt('captcha_on_anon_post') && !isset($userid))
would become parameterizable and the caller will determine if the captcha should respect the captcha_on_anon_post or any other setting or criteria.
When the "Use captcha for anonymous posts" setting is unchecked, captcha is not showing on feedback form, as it is treated as an anonymous post.
I could just fix this by checking if the user is anonymous and, if it is, just avoid calling the
qa_user_captcha_reason()
. The thing is that I would be getting part of the logic from that function out of the function. So I'd rather keep the logic (theif
statement) in the function and just send the function the actual data to process it.In other words, I think it is better to change the signature from:
to:
This way the
would become parameterizable and the caller will determine if the captcha should respect the
captcha_on_anon_post
or any other setting or criteria.Changes should be backwards-compatible as well