I found that points were not being added when a user was referred. Seems to be a typo in "$cookie['uid']" at line 201

if (module_exists('userpoints')) {
      $points = variable_get(REFERRAL_USERPOINTS, 1);
      userpoints_userpointsapi('points', $points, $cookie[$uid], 'referral');
    }

should be

if (module_exists('userpoints')) {
      $points = variable_get(REFERRAL_USERPOINTS, 1);
      userpoints_userpointsapi('points', $points, $cookie['uid'], 'referral');
    }
CommentFileSizeAuthor
#6 patch.txt1.44 KBDebugger_01

Comments

ryan_courtnage’s picture

I can confirm that this is a bug and the suggested fix works.

blnd’s picture

I corrected the typo in the module, but it still doesn't work for me. Referrals are reported, but points still not being added. Please help.

j_ten_man’s picture

I can also confirm this bug and the suggested fix works. Does anyone know what the entity_id is? It has the same typo but I am not sure if it needs to be corrected or not or if has any effect on anything.

CarbonPig’s picture

Is this also a fix for 6.x ??

Thanks,

The Carbon Pig

Debugger_01’s picture

Component: Code » Code: referral

referral-5.x-1.0
output error
Fatal Error: Undefined Function: userpoints_role_userpoints()

referral-5.x-1.x-dev
output error
Undefined Function: ip_address() (it's exists only in drupal 6.x)

I patched dev module. It seems work fine.

Debugger_01’s picture

StatusFileSize
new1.44 KB
kbahey’s picture

Status: Active » Fixed

Fixed in version 5.x-1.x-dev, without the ip_address() function, which does not belong in this module.

Also, ported the userpoints functionality to the D6 version.

The new changes will appear in the -dev tarballs in about 6 hours.

Debugger_01’s picture

how about ip_address() function ? It's not exists in drupal 5.

kbahey’s picture

I think there is a patch that makes this function available for Drupal 5.

If you cannot find it in the issue queue, then put it in its own new module. I don't want something that belongs to core to be in a contrib module.

Debugger_01’s picture

This function not belongs in core! And your module uses this function. It exixsts only in drupal 6 core!

kbahey’s picture

Yes, because it is in core in D6.

Debugger_01’s picture

module for 5!

kbahey’s picture

Changed back D5 to $_SERVER['REMOTE_ADDR'] instead of calling a non-existent function.

Debugger_01’s picture

thanks god :)

kbahey’s picture

You are welcome. Enjoy!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.