Ejemplo n.º 1
1
function eMember_aweber_new_signup_user($full_target_list_name, $fname, $lname, $email_to_subscribe)
{
    eMember_log_debug("Attempting to signup the user via AWeber API", true);
    $emember_config = Emember_Config::getInstance();
    $eMember_aweber_access_keys = $emember_config->getValue('eMember_aweber_access_keys');
    if (empty($eMember_aweber_access_keys['consumer_key'])) {
        eMember_log_debug("Missing AWeber access keys! You need to first make a conntect before you can use this API", false);
        return;
    }
    if (!class_exists('AWeberAPI')) {
        //TODO - change the class name to "eMember_AWeberAPI" to avoid conflict with others
        include_once 'lib/auto-responder/aweber_api/aweber_api.php';
        eMember_log_debug("AWeber API library inclusion succeeded.", true);
    } else {
        eMember_log_debug("AWeber API library is already included from another plugin.", true);
    }
    try {
        $aweber = new AWeberAPI($eMember_aweber_access_keys['consumer_key'], $eMember_aweber_access_keys['consumer_secret']);
        $account = $aweber->getAccount($eMember_aweber_access_keys['access_key'], $eMember_aweber_access_keys['access_secret']);
        //Get Aweber account
        $account_id = $account->id;
        $mylists = $account->lists;
    } catch (Exception $e) {
        eMember_log_debug($e->getMessage(), false);
        return;
    }
    eMember_log_debug("AWeber account retrieved. Account ID: " . $account_id, true);
    $target_list_name = str_replace("@aweber.com", "", $full_target_list_name);
    eMember_log_debug("Attempting to signup the user to the AWeber list: " . $target_list_name, true);
    $list_name_found = false;
    foreach ($mylists as $list) {
        if ($list->name == $target_list_name || $list->unique_list_id == $target_list_name) {
            $list_name_found = true;
            try {
                //Create a subscriber
                $params = array('email' => $email_to_subscribe, 'name' => $fname . ' ' . $lname);
                $subscribers = $list->subscribers;
                $new_subscriber = $subscribers->create($params);
                eMember_log_debug("User with email address " . $email_to_subscribe . " was added to the AWeber list: " . $target_list_name, true);
            } catch (Exception $exc) {
                eMember_log_debug("Failed to complete the AWeber signup! Error Details Below.", false);
                eMember_log_debug_array($exc, true);
            }
        }
    }
    if (!$list_name_found) {
        eMember_log_debug("Error! Could not find the AWeber list (" . $full_target_list_name . ") in your AWeber Account! Please double check your list name value for typo.", false);
    }
}
Ejemplo n.º 2
0
    eMember_log_debug("Clickbank IPN authenticity failed! This payment notification will not be processed!", false);
    exit;
}
$cb_ipn_data = array();
$cb_ipn_data['txn_type'] = $_POST['ctransaction'];
$cb_ipn_data['payer_email'] = $_POST['ccustemail'];
$cb_ipn_data['first_name'] = $_POST['ccustfirstname'];
$cb_ipn_data['last_name'] = $_POST['ccustlastname'];
$cb_ipn_data['address_street'] = $_POST['ccustaddr1'] . " " . $_POST['ccustaddr2'];
$cb_ipn_data['address_city'] = $_POST['ccustcity'];
$cb_ipn_data['address_state'] = $_POST['ccuststate'];
$cb_ipn_data['address_zip'] = $_POST['ccustzip'];
$cb_ipn_data['address_country'] = $_POST['ccustshippingcountry'];
$cb_ipn_data['txn_id'] = $_POST['ctransreceipt'];
$cb_ipn_data['custom'] = $_POST['cvendthru'];
eMember_log_debug_array($cb_ipn_data, true);
//------------ key value pair for the custom data --------------
$custom = $cb_ipn_data['custom'];
$delimiter = "&";
$customvariables = array();
$namevaluecombos = explode($delimiter, $custom);
foreach ($namevaluecombos as $keyval_unparsed) {
    $equalsignposition = strpos($keyval_unparsed, '=');
    if ($equalsignposition === false) {
        $customvariables[$keyval_unparsed] = '';
        continue;
    }
    $key = substr($keyval_unparsed, 0, $equalsignposition);
    $value = substr($keyval_unparsed, $equalsignposition + 1);
    $customvariables[$key] = $value;
}