I'm trying to find out what the highest role a user has, by points. The userpoints_role_highest_role() function fetches the current points for a given user, fetches all of the roles and points for those roles, and then builds an associative array of point value => role name of all the roles for the user. It then returns the output of max() on this array.
However, MAX() doesn't work that way. When passed an array, it sorts the values and returns the highest value. In my case, the role "wizard" is getting returned incorrectly, simply because that's what MAX() returns as the highest. Here's what the module needs to do instead:
return $roles_within[max(array_keys($roles_within))];
Comment | File | Size | Author |
---|---|---|---|
#1 | 1365354-userpoints_role.module.patch | 627 bytes | ebeyrent |
Comments
Comment #1
ebeyrent CreditAttribution: ebeyrent commentedHere's a patch....
Comment #2
Berdir