Active
Project:
User Referral
Version:
6.x-1.x-dev
Component:
Code: referral
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Dec 2008 at 11:16 UTC
Updated:
11 Oct 2010 at 16:46 UTC
Hi there,
I set up the following:
I made a new panel and set it path to user/% (so, it will appear on user profile page).
When testing it with user referral, I saw that either the cookie is not being implented or something else I can't explain.
The referral is not counted using when using panels.
Thanks
Comments
Comment #1
kbahey commentedThat is an interesting case.
I am hoping that with panels, the original path is still called, but can't be sure with such overriding.
Can you go into the referral.module code and add a print statement where it sets the cookie, and see if it is indeed called? Do that in the beginning of referral_user() too.
If all that fails, then ask in Panels queue if you override /user/uid, what will happen?
Comment #2
asak commentedHi there i'm jumping in for i need something which seems very close to this use case.
I understand one of the latest commits included the ability to track visits to the user profile as a "referral link", which is great. one of the threads here (http://drupal.org/node/347207) mentioned this doesn't work however when using pathauto.module. Now this issue is about sing panels to override user/uid to a panel page.
From what i understand, both pathauto and panels leave the original path and are only aliases (i think!!).
I'm going to give this thing a spin and see what happens.. this is a great module... i'll post back ;)
Comment #3
asak commentedOk so the pathauto part is working great. the panels part isn't.
I'm trying to add a print to the referral_set_cookie and referral_user functions, but i keep getting "Array" printed (while not using panels) instead of the cookie info which is what i believe we're looking for - what would be the correct syntex to print that array ($cookie if i understand what's going on...)?
I do however notice that i don't even get the "Array" printed when overriding user/% using panels if that means much...
Thanks!
Comment #4
asak commentedThis is something...
I'm trying to use the user visits module (http://drupal.org/project/user_visits) to track visits of the profile page. my problem is the same as with this referral module - no tracking is being done when users visit a panels overridden profile page.
I found a thread in there with a solution, for user visits, and maybe the solution offered there could be used for referral as well. i noticed the patch which was submitted in order to capture visits to user/xx pages (using custom paths) was changed and the code isn't as the code in the patch was. since i don't really understand how both codes work when visiting a profile page, there isn't much i can do here.
The patch for user visit is at http://drupal.org/node/280659 . and alternative solution may be to use Content Profile module and/or APK to make it a bit easier (though i don't know really how/why).
I see that referral module is just using the arg(1) of the path to set the cookie. i don't understand the following code that well, but it seems like it could be the solution (taken from the patch above, while user_visits_path could be set to "user/%" for a panel if i'm not mistaken):
Comment #5
asak commentedOK i really need to get this done so i gave it some more thought...
Basically - the problem is that referral_user isn't being called when viewing a panel page, since drupal doesn't consider that to be a user page and so hook_user can't work.
I think a possible solution could be to call referral_set_cookie() using some code in a block which will be displayed in the panel, and manually set arg(1) to the uid of the author of the content_profile being viewed. some code would need to be used so that the referral module performs the validations from referral_user(), but besides that I think this should work...
Would best practice be to add another function? it seems there is no way to use the referral_user() function in this case...
I'll try and report back with the results ;)
Comment #6
asak commentedIt was simple...
Just needed to create a custom block which a) checks the arg()'s to make sure it's a user node, b) make sure user is anonymous, and c) calls sets the cookie.
This needs some fixup... but it works!
Comment #7
nikmahajan commentedthis doesn't works. I put the code in the block and it got displayed as output.
Comment #8
Feonyx commentedYou need to download and install "PHP filter" and add it as custom content.
Feonyx
Comment #9
2ndChanceTech commentedis it possible to change the code to work on other pages? Perhaps pull the UID of the node author?
I'm using Content Profile and users can't see the user/* page.
Any help would be appreciated!
Comment #10
dmetzcher commentedRe: Comment #6 above...
Does it need to be in a block that is displayed on a panel-overridden page...or could it be in a pane on that panel-overridden page?
I used the latter (just a new pane on my panel-overridden page with some custom content - PHP code).
IF this is working (and I need someone to tell me that this is what I should be seeing, I see a few differences in the string stored in each of the cookies when I go to the profile page of two users. What caught my eye was that part of the string contains...
3A1%3A%223
...for user #3 on the site (/user/3)
and...
3A1%3A%224
...for user #4 on the site (/user/4)
and...
3A2%3A%2210
...for user #10 on the site (/user/10)
Question 1:
So... I assume that's the way it's encoded for each of the users account numbers (3, 4, and 10). Is that correct?
Question 2:
I removed the custom PHP pane on the user profile panel page and tested I am getting the same results as above in terms of the 223, 224, and 2210 for visiting user accounts 3, 4, and 10. That seems to indicate that this custom PHP code (comment #6 above) is no longer needed. Does that sound right?
Comment #11
dmetzcher commentedJust as an update, I did some testing today and I can see that users are getting credit for referrals either (1) when an anonymous user visits their profile pages (Content Profile, Advanced Profile Kit, and Panels are all being used for the profile pages on my site) OR (2) when an anonymous user visits their referral URL (
example.com/referral[hex value]). I have registered test users after visiting both URLs for one user and that user has received credit for both signups.I am assuming that this issue has been resolved, based on what I am seeing on my own site with the most current -dev version of this module.
Does anyone disagree?