I really needed to access, programmatically, the User Roles being referenced. This module only comes with a "Role name" display format, so I added two: one that prints the Role IDs (rid) and another that returns a serialized array of Role IDs (rid_array).
I think this is handy, because I specifically needed to compare the user roles being referenced in a node against the roles that the user has been assigned. Now that I can return a serialized array, I can unserialize and then compare, using PHP's array_keys() function on the $user->roles variable.
I tried just returning an array of Role IDs, but all that gets returned is the string "array", so it must be serialized.
Seems like this would be useful for other people, so I offer it here. Hopefully the module maintainer agrees and sees fit to include it in the next release? Here's a patch on 6.x-1.0
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | rid_displayd7-724692-4.patch | 964 bytes | deggertsen |
| rid_display.patch | 1.59 KB | Offlein |
Comments
Comment #1
deekayen commentedComment #3
johnvThis feature is not in D7-version.
Comment #4
deggertsen commentedPatch attached that fixes this issue in D7.
Comment #6
deekayen commented