示例#1
0
<?php

/**
rendering form for user
**/
$old_error_reporting = error_reporting(0);
$form = nmMailChimp::getForm($fid);
if (!empty($form)) {
    $meta = json_decode($form->form_meta);
    $arrVars = $meta->vars;
    /* echo '<pre>';
    	print_r($meta);
    	echo '</pre>'; */
    ?>
	
	<div class="nm_mc_form">
	<form id="nm_mc_form_<?php 
    echo $widget_id;
    ?>
" onsubmit="return postToMailChimp(this)">
	  <input type="hidden" value="<?php 
    echo $fid;
    ?>
" name="nm_mc_form_id" />
	  <ul>
	    <?php 
    if ($arrVars) {
        foreach ($arrVars as $key => $val) {
            $tag = $val->tag;
            $label = $val->label;
            $the_id = $tag . '-' . $widget_id;
示例#2
0
            $this->err = true;
        }
        if ($this->api_key == '') {
            $this->errMessage .= 'No API key found, please set API from plugin option in admin<br />';
            $this->err = true;
        }
        if ($this->list_id == '') {
            $this->errMessage .= 'No List ID found, please set List ID from plugin option in admin<br />';
            $this->err = true;
        }
        /* checking validation for email, list id and api key */
        $this->errMessage .= '</div>';
    }
}
$mailchimp = new postToMailChimp();
$form = nmMailChimp::getForm($_POST['nm_mc_form_id']);
/* print_r($_POST['form_meta']);
 exit; */
$meta = json_decode($form->form_meta);
$mailchimp->list_id = $meta->list_id;
$mailchimp->api_key = get_option('nm_mc_api_key');
$mailchimp->thanks = get_option('nm_mc_thanks_message');
$mailchimp->validateCredentials($posted_data, $meta->vars);
/* pushing list interest/groups into VARS array */
if ($_POST['group']) {
    foreach ($_POST['group'] as $interest => $groups) {
        /* $temp['id'] 	= $grouping -> id;
        		 $temp['groups']	= $grouping -> groups;
        
        		array_push($interest, $temp);
        		$mailchimp -> vars ['GROUPINGS'] = $interest; */