This module is a strong foundation for tracking referrals of any type on a user object. I would like to expand it to include "inbound link tracking" to sit alongside user registration tracking.

To do so I need the referral module to trigger a module_invoke_all('referral', $uid) hook every time the referral menu path is accessed. This should be done after the cookie is set and the rest can easily be worked out in the contrib side.

I would also suggest accommodating for different types of referrals in the core table so that it could be reused by contrib modules through an api.

Id be happy to refactor this to a referral_user module so that the referral module is a little more generic helper and then i can implement views integration at the lower levels for more creative graphing options.

I realize this is a bit of an expansion of the role of this module and if youds liek to open up a 6.x-2.x branch for the module id be happy to isolate the changes there.

Your speedy response will help me complete a project for a client with a near deadline. I have already rewritten the referral menu hook to accommodate passing a full path after the referral/ref_code/GOTO/THIS/PATH and updated the database table to accommodate the new types of referrals.

CommentFileSizeAuthor
#1 referral_refactor.patch1.09 KBmichaelfavia
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

michaelfavia’s picture

FileSize
1.09 KB

Here is a quick shot at the general idea because i explain better in code sometimes.

I will of course have to refactor the rest of the module (DB calls, breakout user functions) and follow it into the contribs that use the hook (unless you'd like to use a new hook instead for BC?). Just looking for a little direction as to how youd like to handle it if at all.

michaelfavia’s picture

Any feedback welcome. Drupal doesnt need yet another module for this and im trying to work within your module setup. If you don't want the features just let me know and ill move them elsewhere.

BManuel’s picture

I think @michaelfavia has got a point here, this module can make use of refactoring. +1 for branching out if you get no response. Any updates on your effort?

jazzdrive3’s picture

I have been working on porting it to Drupal 7. Seems like a good idea, and I can add the invoke to the proper place once we get the 7.x branch officially on here.

alliax’s picture

michaelfavia your code works, and even if nobody seems interested I'm sure many of user referrals module assumed your could set the module so that users can refer people to any page of the site.

So with your patch, it adds in the module the ability to do that, redirect to any page specified in the url's arguments, if any, if not specified redirects following the module admin settings.