i try to use your greate software.
Is it possible to change submitcontent form:
for registered user it will be no captcha and in the name field - username?
Thanks.
You can certainly pre-fill information for registered users - you will find many examples in the Forums here.
It is much more difficult to turn the Captcha off for some users and not for others. It may be possible though.
Bob
It's OK with pre-fill information.
It is much more difficult to turn the Captcha off for some users and not for others. It may be possible though.
Isn't it a good challenge for developers, and not for us, dilettantes :-).
I am sure that many peoples need this capability.
Thanks.
its easy to do but must be with file hacks, do you need it so badly ?
Regards
Max
its easy to do but must be with file hacks, do you need it so badly ?
Max
Yes, I need it really.
Thanks.
I just did something similar for a client. I've hacked out the main code chunks here
Turn Anti-spam OFF in the ChronoForms settings to suppress the ChronoForms tests. In the form HTML add
<?php
if ( $user->id == 0 ) {
showImageVerification();
}
?>
. . .
<?php
function showImageVerification() {
?>
<fieldset>
<legend>Security check</legend>
<div>Please type the letters from the image on the right into the box below.</div>
<div><label for="chrono_verification">Β </label>
<input id="chrono_verification" type="text" value="" name="chrono_verification"/>
<img src="components/com_chronocontact/chrono_verification.php?imtype=1"/>
</div>
</fieldset>
<?php
}
?>
and in the OnSubmit code<?php
$user = &JFactory::getUser();
if ( $user->id == '0' ) {
$session =& JFactory::getSession();
$sessionvar = $session->get('chrono_verification', 'default', md5('chrono'));
if ( $debug ) echo "sessionvar: ".print_r($sessionvar, true)."<br />";
$chrono_verification = strtolower($_POST['chrono_verification']);
if ( $debug ) echo "md5(chrono_verification): ".print_r(md5($chrono_verification), true)."<br />";
if ( md5($chrono_verification) != $sessionvar ) {
showErrorMessage('Sorry, You have entered a wrong verification code, Please try again!!');
JRequest::setVar('form', '');
$rows[0]->autogenerated = '';
unset($_SESSION['chrono_verification']);
showform($_POST);
return;
} else {
unset($_SESSION['chrono_verification']);
}
}
?>
NB: not tested and may need debugging (I changed the 'if' tests here to use $user->id).Bob
Later: edited to add two missing lines at the beginning of the OnSubmit code.
It works well. π
I will try to use this code in Chrono Comments too (hope, it is possible).
Soon I will pay Chrono Forms License and vote excellent Chrono Forms at Joomla.org
Leon
Sorry I haven't tried with ChronoComments but something similar should work I think.
Bob
and in the OnSubmit code
if ( $user->id == '0' ) {
$session =& JFactory::getSession();
$sessionvar = $session->get('chrono_verification', 'default', md5('chrono'));
if ( $debug ) echo "sessionvar: ".print_r($sessionvar, true)."<br />";
$chrono_verification = strtolower($_POST['chrono_verification']);
if ( $debug ) echo "md5(chrono_verification): ".print_r(md5($chrono_verification), true)."<br />";
if ( md5($chrono_verification) != $sessionvar ) {
showErrorMessage('Sorry, You have entered a wrong verification code, Please try again!!');
JRequest::setVar('form', '');
$rows[0]->autogenerated = '';
unset($_SESSION['chrono_verification']);
showform($_POST);
return;
} else {
unset($_SESSION['chrono_verification']);
}
}
?>
NB: not tested and may need debugging (I changed the 'if' tests here to use $user->id).Excuse me,
I must come back.
In this code is missing inadvertently <?php above,
But that's not so bad.
Unfortunately, this code does not work: he accepts any code, and not only the right one.
Any help, please?
Thanks
I've added the missing tag - good catch.
My version of the code works OK for me - I dont' know why it isn't working for you :-(
Bob
Regards
Max
My version of the code works OK for me - I dont' know why it isn't working for you :-(
Bob
Yes, your version of the code works OK for me too NOW.
The problem was that I had followed your council π :
Turn Anti-spam OFF in the ChronoForms settings to suppress the ChronoForms tests.
Anti-spam must be ON.
Regards.
Hmm . . . I understand what you are saying but that doesn't sound right . . . puzzled.
What happens when you are logged in as a user and try to submit with no AntiSpam image showing? My memory is that with Anti_Spam ON ChronoForms still looks for the token and fails asks for the anti-spam code.
Bob
What happens when you are logged in as a user and try to submit with no AntiSpam image showing? My memory is that with Anti_Spam ON ChronoForms still looks for the token, fails to find it and asks for the anti-spam code.
π π π
You are right!
When I logged in as a user and try to submit with no image showing AntiSpam, I get
"PCs are good ... you have entered a wrong code, please re-enter it! "
But if I turn off anti-spam and is not logged in, accept ChronoForms any code.
Should I attach pictures?
Thanks.
Leon
I don't think pictures will help, please will you take a Form Backup using the icon in the Forms Manager and email it to me at the address in my sig. Then I can test the whole form on my setup here.
Bob
... please will you take a Form Backup using the icon in the Forms Manager and email it to me Bob
Hi, Bob.
Thank you for the support.
I've sent the backup.
Leon.
Sorry, it looks as though two lines were missing from the OnSubmit code - it should begin
<?php
$user = &JFactory::getUser();
if ( $user->id == '0' ) {
. . .
Bob
PS I went back and fixed my earlier posting.