Nou... daar gaan we dan

Open lib/module/class.GuestbookFrontend.php.
Voeg eerst een nieuwe foutconstante toe (aan degene die er al staan) bovenaan het script (regel 11):
Code: Select all
define('CMS_GB_ERROR_NO_EMAIL' , 'CMS_GB_ERROR_NO_EMAIL');
Scroll dan naar beneden naar de method/function ValidatePost (regel 299). Hier worden de verstuurde waarden gecontroleerd.
Ietsje lager, regel 347 wordt al van een aantal velden gecontroleerd of ze leeg zijn:
Code: Select all
// Check if fields are filled in
if (!$_POST['sender'])
{
$errors[] = CMS_GB_ERROR_NOSENDER;
}
if (!$_POST['message'] || $_POST['message'] == '')
{
$errors[] = CMS_GB_ERROR_NOMESSAGE;
}
Voeg daar de nieuwe controle toe:
Code: Select all
// Check if fields are filled in
if (!$_POST['sender'])
{
$errors[] = CMS_GB_ERROR_NOSENDER;
}
if (!$_POST['message'] || $_POST['message'] == '')
{
$errors[] = CMS_GB_ERROR_NOMESSAGE;
}
if (!$_POST['e_mail'] || trim($_POST['e_mail']) == '')
{
$errors[] = CMS_GB_ERROR_NO_EMAIL;
}
Sla class.GuestbookFrontend.php nu op en open action.default.php.
Hierin wordt het formulier gepost, rond regel 44 vind je de volgende code:
Code: Select all
// validate the entry
$errors = $frontend->ValidatePost($params, $captcha);
if (!empty($errors))
{
// show errors
$frontend->setShowErrors(TRUE);
$gb_error_messages = array(
CMS_GB_ERROR_NOSENDER => 'fabsend',
CMS_GB_ERROR_NOMESSAGE => 'fmessag',
CMS_GB_ERROR_UNIQUE => 'fui',
CMS_GB_ERROR_TOOSOON => 'toosoon',
CMS_GB_ERROR_INVALID_EMAIL => 'femail',
CMS_GB_ERROR_TOOLONG => 'tolong',
CMS_GB_ERROR_CAPTCHA => 'captcha_failure_message',
CMS_GB_ERROR_BADWORDS => 'badwords_message'
);
Voeg hier de nieuwe fout aan toe:
Code: Select all
// show errors
$frontend->setShowErrors(TRUE);
$gb_error_messages = array(
CMS_GB_ERROR_NOSENDER => 'fabsend',
CMS_GB_ERROR_NOMESSAGE => 'fmessag',
CMS_GB_ERROR_UNIQUE => 'fui',
CMS_GB_ERROR_TOOSOON => 'toosoon',
CMS_GB_ERROR_INVALID_EMAIL => 'femail',
CMS_GB_ERROR_TOOLONG => 'tolong',
CMS_GB_ERROR_CAPTCHA => 'captcha_failure_message',
CMS_GB_ERROR_BADWORDS => 'badwords_message',
CMS_GB_ERROR_NO_EMAIL => 'no_email'
);
Nu moet alleen nog de foutmelding aan het taalbestand (lang/ext/nl_NL.php) worden toegevoegd:
Code: Select all
$lang['no_email'] = 'Voer een E-Mail adres in';
Grtz,
D