Closed (fixed)
Project:
OG User Roles
Version:
5.x-2.4
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
17 Sep 2007 at 16:53 UTC
Updated:
3 Oct 2007 at 20:32 UTC
Jump to comment: Most recent file
In trying to get my module working with OG User Roles, I was forced to make a change to og_user_roles_all_roles(). Whilst this wouldn't be too bad, as there are already dozens of special cases in there for other modules, it strikes me as a better solution to expose a hook in that function so that other modules can provide their own logic without your having to change the OG User Roles code.
I've attached a patch which does this.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | og_user_roles.module.5.x-2.5.patch | 1.19 KB | somebodysysop |
| og_user_roles-2.diff | 633 bytes | dmhouse |
Comments
Comment #1
somebodysysop commentedSeems like a pretty good idea. Let me see if I understand:
1. The hook would be hook_og_user_roles_gid as in "YourModuleName_og_user_roles_gid".
2. hook_og_user_roles_gid would simply return a single Group Node ID which should represent the current group context that a user is in when it's invoked.
3. The module_invoke('og_user_roles_gid') is ran at the end of the $gid if statement in og_user_roles_all_roles(), that is, if the OG group context is not present, then we try to figure it out, and we will use your's if your module presents one.
Is this correct?
If so, what does hook_og_user_roles_gid look like? I know the Return Value is a single Group Node ID. But, are there an input Parameters?
Thanks for the patch and the work!
Comment #2
dmhouse commentedAn implementation of hook_og_user_roles_gid takes no input parameters, and should return the current group context's gid, as you suggest. Here's how I use it in my module:
Comment #3
somebodysysop commentedOK, then, apply this patch against the 2.4 release and see it does the trick.
Comment #4
dmhouse commentedLooks good.
Comment #5
somebodysysop commentedI'll take that as a yes.
Comment #6
(not verified) commented