Forum Replies Created
-
AuthorPosts
-
July 10, 2013 at 4:57 pm in reply to: Affiliate Login – redirect to the welcome page when logging in as an affiliate #56488AffMember
Here is the URL of the page with option 2 implemented:
[http://djcoursesonline.com/afftest/]
Thanks,
July 9, 2013 at 4:50 pm in reply to: Affiliate Login – redirect to the welcome page when logging in as an affiliate #56486AffMemberMy understanding is that, upon logging in, the user should be taken to the members-only.php page that loads a snapshot of their sales data, etc. The welcome page they are being taken to asks them to register or log in (which they just did) and therefore is redirecting improperly.
I’ve had my hosting company test this and they can’t seem to reproduce the error. I know that sometimes if you refresh the page it’ll work and sometimes it won’t (which is why i thought it was a hosting issue, given that they cache aggressively, but upon further testing, they can’t figure much of anything out).
Here’s the affiliate site:
[http://djcoursesonline.com/wp-content/plugins/wp-affiliate-platform/affiliates/login.php]
username: test_affiliate
pw: affpass
Here’s the URL for my site: [http://djcoursesonline.com]
AffMemberHi,
Yes the log is working, but is there an alternative to waiting a month for another recurring payment to come through from a user who was driven to the site from an affiliate, just to test this integration?
As you can see in the integration code and the saveOrder function I posted previously, the wpa_pmpro_add_order should be running whenever recurring payments come through.
AffMemberHi,
I’ve tried reaching the developer but they won’t respond. Below you can see the code for the saveOrder() method that runs each time a stripe order comes through (via webhook). The bottom shows where the pmpro_add_order gets fired. Any other clues as to what may be going wrong?
I appreciate the help.
function saveOrder()
{
global $current_user, $wpdb;
//get a random code to use for the public ID
if(empty($this->code))
$this->code = $this->getRandomCode();
//figure out how much we charged
if(!empty($this->InitialPayment))
$amount = $this->InitialPayment;
elseif(!empty($this->subtotal))
$amount = $this->subtotal;
else
$amount = 0;
//Todo: Tax?!, Coupons, Certificates, affiliates
if(empty($this->subtotal))
$this->subtotal = $amount;
if(isset($this->tax))
$tax = $this->tax;
else
$tax = $this->getTax(true);
$this->certificate_id = “”;
$this->certificateamount = “”;
//calculate total
if(!empty($this->total))
$total = $this->total;
else
$total = (float)$amount + (float)$tax;
//these fix some warnings/notices
if(empty($this->billing))
{
$this->billing->name = $this->billing->street = $this->billing->city = $this->billing->state = $this->billing->zip = $this->billing->country = $this->billing->phone = “”;
}
if(empty($this->user_id))
$this->user_id = “”;
if(empty($this->paypal_token))
$this->paypal_token = “”;
if(empty($this->couponamount))
$this->couponamount = “”;
if(empty($this->payment_type))
$this->payment_type = “”;
if(empty($this->payment_transaction_id))
$this->payment_transaction_id = “”;
if(empty($this->subscription_transaction_id))
$this->subscription_transaction_id = “”;
if(empty($this->affiliate_id))
$this->affiliate_id = “”;
if(empty($this->affiliate_subid))
$this->affiliate_subid = “”;
if(empty($this->session_id))
$this->session_id = “”;
if(empty($this->gateway))
$this->gateway = pmpro_getOption(“gateway”);
if(empty($this->gateway_environment))
$this->gateway_environment = pmpro_getOption(“gateway_environment”);
if(empty($this->notes))
$this->notes = “”;
//build query
if(!empty($this->id))
{
//set up actions
$before_action = “pmpro_update_order”;
$after_action = “pmpro_updated_order”;
//update
$this->sqlQuery = “UPDATE $wpdb->pmpro_membership_orders
SET
code
= ‘” . $this->code . “‘,session_id
= ‘” . $this->session_id . “‘,user_id
= ‘” . $this->user_id . “‘,membership_id
= ‘” . $this->membership_id . “‘,paypal_token
= ‘” . $this->paypal_token . “‘,billing_name
= ‘” . $wpdb->escape($this->billing->name) . “‘,billing_street
= ‘” . $wpdb->escape($this->billing->street) . “‘,billing_city
= ‘” . $wpdb->escape($this->billing->city) . “‘,billing_state
= ‘” . $wpdb->escape($this->billing->state) . “‘,billing_zip
= ‘” . $wpdb->escape($this->billing->zip) . “‘,billing_country
= ‘” . $wpdb->escape($this->billing->country) . “‘,billing_phone
= ‘” . $wpdb->escape($this->billing->phone) . “‘,subtotal
= ‘” . $this->subtotal . “‘,tax
= ‘” . $this->tax . “‘,couponamount
= ‘” . $this->couponamount . “‘,certificate_id
= ‘” . $this->certificate_id . “‘,certificateamount
= ‘” . $this->certificateamount . “‘,total
= ‘” . $this->total . “‘,payment_type
= ‘” . $this->payment_type . “‘,cardtype
= ‘” . $this->cardtype . “‘,accountnumber
= ‘” . $this->accountnumber . “‘,expirationmonth
= ‘” . $this->expirationmonth . “‘,expirationyear
= ‘” . $this->expirationyear . “‘,status
= ‘” . $wpdb->escape($this->status) . “‘,gateway
= ‘” . $this->gateway . “‘,gateway_environment
= ‘” . $this->gateway_environment . “‘,payment_transaction_id
= ‘” . $wpdb->escape($this->payment_transaction_id) . “‘,subscription_transaction_id
= ‘” . $wpdb->escape($this->subscription_transaction_id) . “‘,affiliate_id
= ‘” . $wpdb->escape($this->affiliate_id) . “‘,affiliate_subid
= ‘” . $wpdb->escape($this->affiliate_subid) . “‘,notes
= ‘” . $wpdb->escape($this->notes) . “‘WHERE id = ‘” . $this->id . “‘
LIMIT 1″;
}
else
{
//set up actions
$before_action = “pmpro_add_order”;
$after_action = “pmpro_added_order”;
//insert
$this->sqlQuery = “INSERT INTO $wpdb->pmpro_membership_orders
(
code
,session_id
,user_id
,membership_id
,paypal_token
,billing_name
,billing_street
,billing_city
,billing_state
,billing_zip
,billing_country
,billing_phone
,subtotal
,tax
,couponamount
,certificate_id
,certificateamount
,total
,payment_type
,cardtype
,accountnumber
,expirationmonth
,expirationyear
,status
,gateway
,gateway_environment
,payment_transaction_id
,subscription_transaction_id
,timestamp
,affiliate_id
,affiliate_subid
,notes
)VALUES(‘” . $this->code . “‘,
‘” . session_id() . “‘,
‘” . $this->user_id . “‘,
‘” . $this->membership_id . “‘,
‘” . $this->paypal_token . “‘,
‘” . $wpdb->escape(trim($this->billing->name)) . “‘,
‘” . $wpdb->escape(trim($this->billing->street)) . “‘,
‘” . $wpdb->escape($this->billing->city) . “‘,
‘” . $wpdb->escape($this->billing->state) . “‘,
‘” . $wpdb->escape($this->billing->zip) . “‘,
‘” . $wpdb->escape($this->billing->country) . “‘,
‘” . cleanPhone($this->billing->phone) . “‘,
‘” . $amount . “‘,
‘” . $tax . “‘,
‘” . $this->couponamount. “‘,
‘” . intval($this->certificate_id) . “‘,
‘” . $this->certificateamount . “‘,
‘” . $total . “‘,
‘” . $this->payment_type . “‘,
‘” . $this->cardtype . “‘,
‘” . hideCardNumber($this->accountnumber, false) . “‘,
‘” . substr($this->ExpirationDate, 0, 2) . “‘,
‘” . substr($this->ExpirationDate, 2, 4) . “‘,
‘” . $wpdb->escape($this->status) . “‘,
‘” . $this->gateway . “‘,
‘” . $this->gateway_environment . “‘,
‘” . $wpdb->escape($this->payment_transaction_id) . “‘,
‘” . $wpdb->escape($this->subscription_transaction_id) . “‘,
now(),
‘” . $wpdb->escape($this->affiliate_id) . “‘,
‘” . $wpdb->escape($this->affiliate_subid) . “‘,
‘” . $wpdb->escape($this->notes) . “‘
)”;
}
do_action($before_action, $this);
if($wpdb->query($this->sqlQuery) !== false)
{
if(empty($this->id))
$this->id = $wpdb->insert_id;
do_action($after_action, $this);
return $this->getMemberOrderByID($this->id);
}
else
{
return false;
}
}
AffMemberCan someone please provide feedback – I’m urgently trying to resolve this issue but I need help from the support team here.
AffMemberAlso, just to confirm, the initial payments are being tracked and attributed to the corresponding affiliate, the problem is with recurring payments. By looking at that addon above, are you seeing any reason why recurring payments aren’t being tracked and attributed to the original affiliate?
AffMemberHi admin,
I’m using paid memberships pro (stripe gateway) and i’m currently using their addon plugin hosted here: https://gist.github.com/strangerstudios/3137539
However, I’m not sure how exactly I can a) accomplish tracking and notifying WP affiliate platform of recurring payments and b) how to tie this to the affiliate from the initial purchase.
AffMemberHi oniiru,
I’m curious if you were able to resolve this because I’m in the same position now. I would really appreciate any direction or advice on how to track the recurring payments.
-
AuthorPosts