We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Modify $IN->GBL variable

Development and Programming

Jared Farrish's avatar
Jared Farrish
575 posts
17 years ago
Jared Farrish's avatar Jared Farrish

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?

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.