コード例 #1
0
        print '> Patch Register Plus and sync first/last name with your selected mailing list. <em>Recommended <strong>ON</strong></em>.</p>';
        print '<p><em>News:</em> Register Plus <strong>Redux</strong> is the latest version of "Register Plus".  Please switch to the latest version of Register Plus Redux.</p>';
        print '</fieldset>';
    }
    if (class_exists('RegisterPlusReduxPlugin')) {
        print '<p><strong>You are using <a target="_blank" href="http://wordpress.org/extend/plugins/register-plus-redux/">Register Plus Redux</a></strong> which has a known issue preventing first and last name being synchronized with MailChimp. <em>AutoChimp can fix this</em>.</p>';
        print '<fieldset style="margin-left: 20px;">';
        print "<p><input type=CHECKBOX value=\"on_fix_regplusredux\" name=\"on_fix_regplusredux\" ";
        if ('1' === $fixRegPlusRedux) {
            print "checked";
        }
        print '> Patch Register Plus Redux and sync first/last name with your selected mailing list. <em>Recommended <strong>ON</strong></em>. <strong>Note:</strong> You must enable "<em>Require new users enter a password during registration...</em>" in your Register Plus Redux options in order for the AutoChimp patch to work.</p>';
        print '<p><em>News:</em> Sorry to the folks who were hoping that Register Plus Redux version 3.7.0 and up would fix this.  This patch is still required when running Register Plus Redux.  More info can be found <a href="http://radiok.info/blog/conflicts-begone/" target="_blank">here</a>.</p>';
        print '</fieldset>';
    }
    $syncPlugins = new ACSyncPlugins();
    $syncPlugins->ShowPluginSettings();
    $publishPlugins = new ACPublishPlugins();
    $publishPlugins->ShowPluginSettings();
    $contentPlugins = new ACContentPlugins();
    $contentPlugins->ShowPluginSettings();
    ?>
	
	<div class="submit"><input type="submit" name="save_plugin_options" class="button-primary" value="Save Options" /></div>
	
	<div class="clear"></div>
	</div>
	</div>

<?php 
}
コード例 #2
0
ファイル: autochimp.php プロジェクト: isrealconsulting/site
function AC_ManageMailUser($mode, $user_info, $old_user_data, $writeDBMessages)
{
    $apiKey = get_option(WP88_MC_APIKEY);
    $api = new MCAPI_13($apiKey);
    $myLists = $api->lists();
    $errorCode = 0;
    if (null != $myLists) {
        $list_id = -1;
        // See if the user has selected some lists
        $selectedLists = get_option(WP88_MC_LISTS);
        // Put all of the selected lists into an array to search later
        $valuesArray = array();
        $valuesArray = preg_split("/[\\s,]+/", $selectedLists);
        foreach ($myLists['data'] as $list) {
            $list_id = $list['id'];
            // See if this mailing list should be selected
            foreach ($valuesArray as $searchableID) {
                $pos = strpos($searchableID, $list_id);
                if (false === $pos) {
                } else {
                    // First and last names are always added.  NOTE:  Email is only
                    // managed when a user is updating info 'cause email is used as
                    // the key when adding a new user.
                    $merge_vars = array('FNAME' => $user_info->first_name, 'LNAME' => $user_info->last_name);
                    // Grab the extra WP user info
                    $data = AC_FetchMappedWordPressData($user_info->ID);
                    // Add that info into the merge array.
                    AC_AddUserFieldsToMergeArray($merge_vars, $data);
                    // Gather the additional data from AutoChimp plugins
                    $syncPlugins = new ACSyncPlugins();
                    $syncPlugins->SyncData($merge_vars, $user_info->ID);
                    // This one gets static data...add it as well to the array.
                    $data = AC_FetchStaticData();
                    // Add that info into the merge array.
                    AC_AddUserFieldsToMergeArray($merge_vars, $data);
                    switch ($mode) {
                        case MMU_ADD:
                            // Check to see if the site wishes to bypass the double opt-in feature
                            $doubleOptIn = 0 === strcmp('1', get_option(WP88_MC_BYPASS_OPT_IN)) ? false : true;
                            $retval = $api->listSubscribe($list_id, $user_info->user_email, $merge_vars, 'html', $doubleOptIn);
                            // Start all error notifications with a date.
                            $errorString = date("(Y-m-d H:i:s) ");
                            if ($api->errorCode) {
                                $errorCode = $api->errorCode;
                                // Set latest activity - displayed in the admin panel
                                $errorString = "Problem pushing {$user_info->first_name} {$user_info->last_name} ('{$user_info->user_email}') to list {$list_id}.  Error Code: {$errorCode}, Message: {$api->errorMessage}, Data: ";
                                $errorString .= print_r($merge_vars, TRUE);
                            } else {
                                $errorString = "Pushed {$user_info->first_name} {$user_info->last_name} ('{$user_info->user_email}') to list {$list_id}.";
                            }
                            AC_Log($errorString);
                            if (FALSE != $writeDBMessages) {
                                update_option(WP88_MC_LAST_MAIL_LIST_ERROR, $errorString);
                            }
                            break;
                        case MMU_DELETE:
                            $deleteMember = '1' === get_option(WP88_MC_PERMANENTLY_DELETE_MEMBERS);
                            $sendGoodbye = '1' === get_option(WP88_MC_SEND_GOODBYE);
                            $sendNotify = '1' === get_option(WP88_MC_SEND_ADMIN_NOTIFICATION);
                            update_option(WP88_MC_LAST_MAIL_LIST_ERROR, $lastMessage);
                            $retval = $api->listUnsubscribe($list_id, $user_info->user_email, $deleteMember, $sendGoodbye, $sendNotify);
                            $rightNow = date("(Y-m-d H:i:s) ");
                            if ($api->errorCode) {
                                $errorCode = $api->errorCode;
                                if (FALSE != $writeDBMessages) {
                                    // Set latest activity - displayed in the admin panel
                                    update_option(WP88_MC_LAST_MAIL_LIST_ERROR, "{$rightNow} Problem removing {$user_info->first_name} {$user_info->last_name} ('{$user_info->user_email}') from list {$list_id}.  Error Code: {$errorCode}, Message: {$api->errorMessage}");
                                }
                            } else {
                                if (FALSE != $writeDBMessages) {
                                    update_option(WP88_MC_LAST_MAIL_LIST_ERROR, "{$rightNow} Removed {$user_info->first_name} {$user_info->last_name} ('{$user_info->user_email}') from list {$list_id}.");
                                }
                            }
                            break;
                        case MMU_UPDATE:
                            $updateEmail = $old_user_data->user_email;
                            $rightNow = date("(Y-m-d H:i:s) ");
                            // Potential update to the email address (more likely than name!)
                            $merge_vars['EMAIL'] = $user_info->user_email;
                            // No emails are sent after a successful call to this function.
                            $retval = $api->listUpdateMember($list_id, $updateEmail, $merge_vars);
                            if ($api->errorCode) {
                                $errorCode = $api->errorCode;
                                if (FALSE != $writeDBMessages) {
                                    // Set latest activity - displayed in the admin panel
                                    $errorString = "{$rightNow} Problem updating {$user_info->first_name} {$user_info->last_name} ('{$user_info->user_email}') from list {$list_id}.  Error Code: {$errorCode}, Message: {$api->errorMessage}, Data: ";
                                    $errorString .= print_r($merge_vars, TRUE);
                                    update_option(WP88_MC_LAST_MAIL_LIST_ERROR, $errorString);
                                }
                            } else {
                                if (FALSE != $writeDBMessages) {
                                    $errorString = "{$rightNow} Updated {$user_info->first_name} {$user_info->last_name} ('{$user_info->user_email}') from list {$list_id}.";
                                    // Uncomment this to see debug info on success
                                    //$errorString .= ' Data: ';
                                    //$errorString .= print_r( $merge_vars, TRUE );
                                    update_option(WP88_MC_LAST_MAIL_LIST_ERROR, $errorString);
                                }
                            }
                            break;
                    }
                }
            }
        }
    }
    return $errorCode;
}