Download & Extend

UC Affiliate 2 x Domain User; when a user's domain is hit, set affiliate data

Project:Ubercart Affiliate v2
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Issue tags:affiliate, domain, domain user, subdomains, Ubercart

Issue Summary

The built-in subdomain management in UC Affiliate didn't work for me, as it conflicts with "any other module that manages subdomains" (from documentation). Got the infinite redirect loop issue described in another thread.

This short function can be placed into a module to work in conjunction with Domain User; when a user's domain is hit, we set the affiliate cookie. Not sure if this should be merged with UC Affiliate2, Domain User, or it's own standalone glue module...

function domain_user_x_affiliate2_init() {
$domain = domain_get_domain();
if(isset($domain['uid']) && $domain['uid'] > 0) {
$account = user_load(array('uid' => $domain['uid']));
_uc_affiliate2_clicked($account, $_GET['q']); // no need for check_access as _u_a_c function does this for us.
}
}

Comments

#1

Status:needs review» needs work

In this form, it doesn't belong in uc_affiliate2.
Maybe in a better form (where it checks if that module is enabed and provides integration..)

#2

Does it working for you?
I created a module use your code above, but it not work for me just as my want.

nobody click here