k, each input, textbox, checkbox, etc. returns a name/value pair to the code that will process the form. You want to add all of your added fields to the value being returned with the name/value pair identified by
. To do this you need to make that value into an array and add all your extra fields to it. This is how:
1. find
. This identifies $message as an array and further identifies this particular name/value pair by the index, msg.
2. for each of your extra fields that you want to be included in the body of your email, make the name of the input (or textarea, whatever) to read
, and so on for all your additional fields.
3. As I said in my previous post, you will have to edit profiles.php if you are using those functions to process the forms. Here is an edited version of the function contactemail() (from gl1.3.9). Just copy this over the one in profiles.php.
remember to back up your stuff.
Text Formatted Code
function contactemail($uid,$author,$authoremail,$subject,$message)
{
global $_CONF, $_TABLES, $_USER, $LANG08;
// check for correct $_CONF permission
if (empty ($_USER['username']) &&
(($_CONF['loginrequired'] == 1) || ($_CONF['emailuserloginrequired'] == 1))
&& ($uid != 2)) {
return COM_refresh ($_CONF['site_url'] . '/index.php');
}
// check for correct 'to' user preferences
$result = DB_query ("SELECT emailfromadmin,emailfromuser FROM {$_TABLES['userprefs']} WHERE uid = '$uid'");
$P = DB_fetchArray ($result);
if (SEC_inGroup ('Root') || SEC_hasRights ('user.mail')) {
$isAdmin = true;
} else {
$isAdmin = false;
}
if ((($P['emailfromadmin'] != 1) && $isAdmin) ||
(($P['emailfromuser'] != 1) && !$isAdmin)) {
return COM_refresh ($_CONF['site_url'] . '/index.php');
}
// check mail speedlimit
COM_clearSpeedlimit ($_CONF['speedlimit'], 'mail');
if (COM_checkSpeedlimit ('mail') > 0) {
return COM_refresh ($_CONF['site_url'] . '/index.php');
}
if (!empty($author) && !empty($subject) && !empty($message)) {
if (COM_isemail($authoremail)) {
$result = DB_query("SELECT username,fullname,email FROM {$_TABLES['users']} WHERE uid = $uid");
$A = DB_fetchArray($result);
// Append the user's signature to the message
$sig = '';
if ($_USER['uid'] > 1) {
$sig = DB_getItem ($_TABLES['users'], 'sig', "uid={$_USER['uid']}");
if (!empty ($sig)) {
$sig = strip_tags (COM_stripslashes ($sig));
$sig = "\n\n-- \n" . $sig;
}
}
if (is_array($subject)) {
$newsubject = '';
foreach ($subject as $key => $value) {
$newsubject .= $key . ': ' . $value . "\n";
}
$subject = $newsubject;
}
$subject = strip_tags (COM_stripslashes ($subject));
$subject = substr ($subject, 0, strcspn ($subject, "\r\n"));
$message = strip_tags (COM_stripslashes ($message)) . $sig;
if (!empty ($A['fullname'])) {
$to = COM_formatEmailAddress ($A['fullname'], $A['email']);
} else {
$to = COM_formatEmailAddress ($A['username'], $A['email']);
}
$from = COM_formatEmailAddress ($author, $authoremail);
COM_mail ($to, $subject, $message, $from);
COM_updateSpeedlimit ('mail');
$retval .= COM_refresh($_CONF['site_url'] . '/index.php?msg=27');
} else {
$retval .= COM_siteHeader ('menu', $LANG04[81])
. COM_errorLog ($LANG08[3], 2)
. contactform ($uid, $subject, $message)
. COM_siteFooter ();
}
} else {
$retval .= COM_siteHeader ('menu', $LANG04[81])
. COM_errorLog ($LANG08[4], 2)
. contactform ($uid, $subject, $message)
. COM_siteFooter ();
}
return $retval;
}
Text Formatted Code
if (is_array($subject)) {
$newsubject = '';
foreach ($subject as $key => $value) {
$newsubject .= $key . ': ' . $value . "\n";
}
$subject = $newsubject;
}