Plugin Directory

Changeset 1196170


Ignore:
Timestamp:
07/10/2015 10:07:26 AM (11 years ago)
Author:
woorockets
Message:

Update mailchimp injection.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wr-contactform/trunk/addons/mailchimp/addon-mailchimp.php

    r1013689 r1196170  
    8282     */
    8383    public function settings_panel( $form, $formStyle, $formSettings, $listPage, $listFontType, $items, $formItems, $formPage ) {
    84         if ( isset( $_GET['post'] ) ) {
     84        if ( isset( $_GET['post'] ) && (int) $_GET['post'] ) {
    8585            global $wpdb;
    8686            $mailchimpSettings = json_decode( get_post_meta( $_GET['post'], 'mailchimp_settings', true ) );
    87             $formPages = $wpdb->get_results( "SELECT page_content FROM {$wpdb->prefix}wr_contactform_form_pages WHERE form_id = {$_GET['post']} ORDER BY page_id ASC" );
    88             $formFields = array();
    89             foreach ( $formPages as $formPage ) {
    90                 $formPageFields = json_decode( $formPage->page_content );
    91                 $formFields += $formPageFields;
     87
     88            $form_id = (int) $_GET['post'];
     89            if ( $form_id > 0 ) {
     90                $formPages = $wpdb->get_results( "SELECT page_content FROM {$wpdb->prefix}wr_contactform_form_pages WHERE form_id = {$form_id} ORDER BY page_id ASC" );
     91                $formFields = array();
     92                foreach ( $formPages as $formPage ) {
     93                    $formPageFields = json_decode( $formPage->page_content );
     94                    $formFields += $formPageFields;
     95                }
     96            } else {
     97                return;
    9298            }
     99
     100           
    93101        } else {
    94102            $mailchimpSettings = new stdClass();
Note: See TracChangeset for help on using the changeset viewer.