Hello All,
I have a question. I am looking at an extension solution for a multiple-mailing list signup form, and I encountered the following code:
<pre><code>$email = $IN->GBL(‘email’); $email = trim(strip_tags($email)); $list = $IN->GBL(‘list’, ‘POST’); $list_id = FALSE;
…
if ($this->email_confirm == FALSE)
{
$DB->query("INSERT INTO exp_mailing_list (user_id, list_id, authcode, email, ip_address)
VALUES ('', '".$DB->escape_str($list_id)."', '".$code."', '".$DB->escape_str($email)."', '".$DB->escape_str($IN->IP)."')");
$content = $LANG->line('ml_email_accepted');
$return = $_POST['RET'];
}
else
{
$DB->query("INSERT INTO exp_mailing_list_queue (email, list_id, authcode, date) VALUES ('".$DB->escape_str($email)."', '".$DB->escape_str($list_id)."', '".$code."', '".time()."')");
$this->send_email_confirmation($email, $code, $list_id);
$content = $LANG->line('ml_email_confirmation_sent')."\n\n";
$content .= $LANG->line('ml_click_confirmation_link');
} [/code]
Now, I do NOT want to copy/paste this code. What I want to do is feed each list name into the function. However, since it uses a global variable from the POST, this doesn’t actually seem possible. Or, at least, it doesn’t seem preferable, or the EE Way©.
Is there a recommended way of doing this? Or will I just need to recreate the function in it’s entirety and detect a $IN->GBL(‘multilist’, ‘POST’) and then feed each through a copy of the script?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.