Option to disable captcha if logged in [SOLVED] with answer
Moderator: Thorsten
Option to disable captcha if logged in [SOLVED] with answer
Since people are manually approved when they register, we can assume that they are trusted. How about that if logged in no captcha for adding items. This also enables admins to add items without the pain of doing the captcha every time.
Last edited by microbe on Sun Jun 10, 2012 3:23 am, edited 1 time in total.
All the best,
Steve
Sorry...what was the question?
Steve
Sorry...what was the question?
Re: Option to disable captcha if logged in
Hmmm...poking along because I am keen to make this happen I found this
/inc/PMF_Helper/Captcha.php
based on in index.php
I thought that using this might work && !isset($auth)
but it doesn't.
Am I heading in the right direction?
/inc/PMF_Helper/Captcha.php
Code: Select all
if (PMF_Configuration::getInstance()->get('spam.enableCaptchaCode')) {
Code: Select all
if (isset($auth)) {
$loginTemplate = 'loggedin.tpl';
I thought that using this might work && !isset($auth)
Code: Select all
if (PMF_Configuration::getInstance()->get('spam.enableCaptchaCode') && !isset($auth) ) {
Am I heading in the right direction?
All the best,
Steve
Sorry...what was the question?
Steve
Sorry...what was the question?
Re: Option to disable captcha if logged in [SOLVED]
Oh how I love solving my own questions
I found that the $auth value wasn't being passed into the function and without searching on how to make it global (with maybe some implications elsewhere) I decided to pass the value through.
Since I only really want this behaviour on the add page, in /add.php I have made this change on line 78 - it should work in any other page too
Change the code to
to catch the value
and pass the value into the function in /inc/PMF_Helper/Captcha.php
becomes
and then test for it being set...
becomes
Now there is a captcha on the add FAQ page for those not logged in and it is not rendered for those who are.
Sweet!
Hope it helps someone else.
I found that the $auth value wasn't being passed into the function and without searching on how to make it global (with maybe some implications elsewhere) I decided to pass the value through.
Since I only really want this behaviour on the add page, in /add.php I have made this change on line 78 - it should work in any other page too
Code: Select all
'captchaFieldset' => PMF_Helper_Captcha::getInstance()->renderCaptcha(
$captcha,
'add',
$PMF_LANG['msgCaptcha']
),
Code: Select all
'captchaFieldset' => PMF_Helper_Captcha::getInstance()->renderCaptcha(
$captcha,
'add',
$PMF_LANG['msgCaptcha'],'',$auth
),
and pass the value into the function in /inc/PMF_Helper/Captcha.php
Code: Select all
public function renderCaptcha(PMF_Captcha $captcha, $action, $legend, $error = '')
becomes
Code: Select all
public function renderCaptcha(PMF_Captcha $captcha, $action, $legend, $error = '', $auth)
Code: Select all
if (PMF_Configuration::getInstance()->get('spam.enableCaptchaCode') ) {
Code: Select all
if (PMF_Configuration::getInstance()->get('spam.enableCaptchaCode') && !isset($auth) ) {
Sweet!
Hope it helps someone else.
All the best,
Steve
Sorry...what was the question?
Steve
Sorry...what was the question?
Re: Option to disable captcha if logged in [SOLVED] with ans
Hi,
very nice... will add this to 2.8
bye
Thorsten
very nice... will add this to 2.8
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
amazon.de Wishlist
Re: Option to disable captcha if logged in [SOLVED] with ans
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
amazon.de Wishlist
Re: Option to disable captcha if logged in [SOLVED] with ans
Cool, glad to be able to contribute.
I noticed your code is different to mine, mine works so do you see any problems leaving it like that?
I noticed your code is different to mine, mine works so do you see any problems leaving it like that?
All the best,
Steve
Sorry...what was the question?
Steve
Sorry...what was the question?
Re: Option to disable captcha if logged in [SOLVED] with ans
Hi,
it's different because I added to the upcoming phpMyFAQ 2.8 alpha2 release which has a lot of improvements.
bye
Thorsten
it's different because I added to the upcoming phpMyFAQ 2.8 alpha2 release which has a lot of improvements.
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
amazon.de Wishlist