Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
remove original action and create a new one.
function group_buying_subscription_new()
{
if( isset( $_POST['set-group-buying-subscription'] ) && !isset( $_POST['email_address'] ) ) {
setcookie( 'your-selected-location', $_POST['deal_location'], time( ) + 24 * 60 * 60 * 30, '/' );
wp_redirect( site_url() );
exit();
}
elseif( isset( $_POST['set-group-buying-subscription'] ) ) {
require_once 'utilities/MCAPI.class.php';
$apikey = get_buyer_config_option('group-buying-theme-mc-api-key');
$fieldname = get_buyer_config_option('group-buying-theme-mc-location-field');
$api = new MCAPI($apikey);
$api->setTimeout(5);
$merge_vars = array( $fieldname => $_POST['deal_location'] );
$listId = get_buyer_config_option('group-buying-theme-mc-list-id');
$retval = $api->listSubscribe( $listId, $_POST['email_address'], $merge_vars );
if ($api->errorMessage) {
Group_Buying_Utility::storeMessage($api->errorMessage);
}
if ( !$api->errorCode && $_POST['deal_location'] != null || $api->errorCode == '214' && $_POST['deal_location'] != null ) {
setcookie( 'your-selected-location', $_POST['deal_location'], time() + 24 * 60 * 60 * 30, '/' );
wp_redirect( site_url() );
exit();
}
}
}
remove_action( 'init', 'group_buying_subscription' );
add_action( 'init', 'group_buying_subscription_new' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.