Email required field
Email required field
Script URL:
Version of script: 1.7
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:
Write your message below:
Upgraded to version 1.7 from 1.6 and there is no longer any option to enforce email address entry as a required field. Is there any way of re-enabling this feature in 1.7?
Version of script: 1.7
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:
Write your message below:
Upgraded to version 1.7 from 1.6 and there is no longer any option to enforce email address entry as a required field. Is there any way of re-enabling this feature in 1.7?
Hello PeteS
Did you search the forum?
In version 1.6 this was not an option either, remember this post: viewtopic.php?p=11054#11054 ?
But because this is a new version, here it goes:
Required e-mail address for GBook version 1.7
Edit file settings.php
AddPut it before /* DO NOT EDIT BELOW */
Edit file gbook.php
Search for (lines 778-782)
and replace with (insert new code at line 778)
Edit file language.inc.php
ChangeTo
and add
Put it before ?>
Greetings,
Henrie
Did you search the forum?
In version 1.6 this was not an option either, remember this post: viewtopic.php?p=11054#11054 ?
But because this is a new version, here it goes:
Required e-mail address for GBook version 1.7
Edit file settings.php
Add
Code: Select all
/* Entering your e-mail address is required? 1 = YES, 0 = NO */
$settings['req_email']=1;
Edit file gbook.php
Search for (lines 778-782)
Code: Select all
if ($email=='INVALID')
{
$error_buffer .= $lang['e04'].'<br class="clear" />';
$email = '';
}
Code: Select all
/* Required e-mail address modification by Henrie, now checks for required e-mail field as defined in settings file */
if ($settings['req_email'] == 1 && empty($email))
{
$error_buffer .= $lang['hl_e01'].'<br class="clear" />';
}
/* End of required e-mail address modification by Henrie, now checks for required e-mail field as defined in settings file */
if ($email=='INVALID')
{
$error_buffer .= $lang['e04'].'<br class="clear" />';
$email = '';
}
Change
Code: Select all
$lang['t52']='Your e-mail:';
Code: Select all
$lang['t52']='<b>Your e-mail:</b>';
Code: Select all
$lang['hl_e01']='Please enter your e-mail address';
Greetings,
Henrie
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
-
- Posts: 2
- Joined: Mon Sep 28, 2009 12:40 pm
Hi, I'm a complete and utter n00b when it comes to coding, so when I looked at this, the amount of new coding just baffled me a bit. However, I looked at the coding myself and thought this might be a simpler method. It seemed to work for me, but I was wondering if anyone could check just to make sure its ok.
Edit gbook.php
Origional:
New:
Then edit the language.inc.php
Origional:
New:
This way you don't need to edit you settings.php file and you have less to add into the language.inc.php and gbook.php files as there is already an e-mail required error message in the language.inc.php file so you don't need to add your own. It also means you can edit the other fields in the same way without masses of coding. What do you guys think?
Regards,
Lee
Edit gbook.php
Origional:
Code: Select all
if ($email=='INVALID')
{
$error_buffer .= $lang['e04'].'<br class="clear" />';
$email = '';
}
Code: Select all
if (empty($email))
{
$error_buffer .= $lang['e04'].'<br class="clear" />';
}
Origional:
Code: Select all
$lang['t52']='Your e-mail:';
Code: Select all
$lang['t52']='<b>Your e-mail:</b>';
Regards,
Lee
Hello Lee,
This will only check for empty e-mail addresses, not for valid e-mail address. My example leaves the validity check intact and when it is used, it is also easy to set it back to not required just by changing a setting in the settings.php file.
If you would like to have the empty and validity check, change the code to something like
Bytheway, with your code you also need to change the following language stringto something that does not say that you can leave it empty because that is clearly not the case anymore.
Greetings,
Henrie
This will only check for empty e-mail addresses, not for valid e-mail address. My example leaves the validity check intact and when it is used, it is also easy to set it back to not required just by changing a setting in the settings.php file.
If you would like to have the empty and validity check, change the code to something like
Code: Select all
if ($email=='INVALID'||empty($email))
{
$error_buffer .= $lang['e04'].'<br class="clear" />';
$email = '';
}
Code: Select all
$lang['e04']='Enter a valid e-mail address or leave it empty';
Greetings,
Henrie
I do not monitor the Gbook forums regularly anymore since I do not use the Gbook script myself anymore for a long time. But it helped me a lot in learning to understand php.
-
- Posts: 2
- Joined: Mon Sep 28, 2009 12:40 pm
-
- Posts: 2
- Joined: Sat Apr 10, 2021 8:26 pm
Re: Email required field
Thank you. I made these changes to Gbook version 1.82 and they seem to be working without error.
The only thing is I did not find the following code within the language.inc.php file as indicated above:
So I added the new code of: right after the line of code which says: and this seems to work fine too.
The only thing is I did not find the following code within the language.inc.php file as indicated above:
Code: Select all
?>
Code: Select all
$lang['hl_e01']='Please enter your e-mail address';
Code: Select all
$lang['t66']='E-mails are hidden from public';