1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-18 04:12:00 +02:00

Contact form is now more flexible, allowing for custom fields in the template and customization of the email subject.

This commit is contained in:
Cameron
2015-08-17 11:22:24 -07:00
parent d19906944b
commit ec5db40d67
6 changed files with 81 additions and 22 deletions

View File

@@ -90,7 +90,9 @@ class contact_shortcodes extends e_shortcode
function sc_contact_name($parm='')
{
return "<input type='text' style='max-width:99%' id='contactName' title='Your full name' name='author_name' required='required' size='30' class='tbox form-control' value=\"".varset($_POST['author_name'])."\" />";
$userName = deftrue('USERNAME');
return "<input type='text' style='max-width:99%' id='contactName' title='Your full name' name='author_name' required='required' size='30' class='tbox form-control' value=\"".varset($_POST['author_name'],$userName)."\" />";
}
@@ -98,7 +100,10 @@ class contact_shortcodes extends e_shortcode
function sc_contact_email($parm='')
{
return "<input type='email' style='max-width:99%' id='contactEmail' title='a valid email address' name='email_send' required='required' size='30' class='tbox form-control' value='".(vartrue($_POST['email_send']) ? $_POST['email_send'] : USEREMAIL)."' />";
$userEmail = deftrue('USEREMAIL');
$disabled = (!empty($userEmail)) ? 'readonly' : ''; // don't allow change from a verified email address.
return "<input type='email' style='max-width:99%' ".$disabled." id='contactEmail' title='a valid email address' name='email_send' required='required' size='30' class='tbox form-control' value='".(vartrue($_POST['email_send']) ? $_POST['email_send'] : USEREMAIL)."' />";
}

View File

@@ -65,7 +65,6 @@ $CONTACT_TEMPLATE['menu'] = '
$CONTACT_WRAPPER['form']['CONTACT_EMAIL_COPY'] = "<tr><td>{---}".LANCONTACT_07."</td></tr>";
$CONTACT_WRAPPER['form']['CONTACT_PERSON'] = "<tr><td>".LANCONTACT_14."<br />{---}</td></tr>";
//FIXME Upgrade to bootstrap3 non-table format for phone/tablet compatibility.
$CONTACT_TEMPLATE['form'] = "
<form action='".e_SELF."' method='post' id='contactForm' >
<table class='table'>
@@ -87,14 +86,17 @@ $CONTACT_TEMPLATE['menu'] = '
</td></tr>
{CONTACT_IMAGECODE}
{CONTACT_IMAGECODE_INPUT}
<tr><td>
{CONTACT_SUBMIT_BUTTON}
</td></tr>
</table>
</form>";
// Customize the email subject
// Variables: CONTACT_SUBJECT and CONTACT_PERSON as well as any custom fields set in the form. )
$CONTACT_TEMPLATE['email']['subject'] = "{CONTACT_SUBJECT}";
?>