Using with AutoAssignRole and Subdomains
| Project: | User Referral |
| Version: | 6.x-1.x-dev |
| Component: | Code: referral |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Hey guys,
I'm messing around endlessly with this great module.
I'm trying to combine it with AutoAssignRole.module and with Subdomain.module to achieve this scenario:
1. User creates an account using a special path (register/aff) and gets the "Affiliate role" (working!)
2. User page is set to "username.domain.com" (working!)
3. Another user now visits "username.domain.com" and a cookie is set (working!)
4. That user then visits another page and registers to get some other role (register/something) (working!)
5. User is set to be referred by the affiliate. - THIS IS NOT WORKING!
I can see the cookie is correctly being set - but i think what's going on is that since custom registration forms are being used the referral module isn't looking in them to see if the registering user has a cookie.
As long as i don't mess with auto assign role and it's custom registration forms, and use regular registration forms, this works great - but it seems that for some reason the referral isn't working for custom registration forms...
Ideas anyone?
I need to solve this ASAP...
Thanks!

#1
Ok found it...
The problem is not with AAR - it's with the subdomain, and it's quite stupid actually - the domain set when using subdomains is for the subdomain, and not for the domain, and thous the cookie isn't functioning when registering.
I think it's just a matter of changing REFERRAL_COOKIE to the specific domain - and everything should work...
Sorry for the mess, and i hope this helps anyone ;)
This is clearly a "by design" issue...
#2
Ok.. that didn't work... it set the name of the cookie to my domain, while the name should be referral_data, and the HOST should change.. is that possible?
Anyone who knows a bit about cookies around...?
I really need some help here...
Thanks!
#3
Changing title to be more descriptive, and status so others may help if they use that combination.
#4
Possible solution: changing the following line in referral.module:
From:
setcookie(REFERRAL_COOKIE, serialize($cookie), time() + 86400, '/');To:
setcookie(REFERRAL_COOKIE, serialize($cookie), time() + 86400, '/', '.your-domain.com');From a very short test this seems to work correctly now using AAR + Subdomain + Referral !
I'll post back if anything goes wrong again... but i think i got it ;)
Enjoy!