Closed (won't fix)
Project:
OG User Roles
Version:
6.x-4.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Jan 2010 at 12:40 UTC
Updated:
11 Jun 2010 at 17:48 UTC
On an openatrium installation with ucreate module, i couldn't make user roles permissions. After a couple of hours, i find the solution.
It seems the module ucreate load roles before user_roles module throught hook_user(). So re-declaring user_access in hook_user instead of hook_init seems to correct error.
Example of my own hook which redeclare user_access :
function hook_user(){
global $user;
// Roles by groups
$space = spaces_get_space();
$group = $space->group;
$gid = $group->nid;
$result = db_query("SELECT ogur.rid, r.name FROM {og_users_roles} ogur INNER JOIN {role} r ON r.rid = ogur.rid WHERE ogur.uid = %d AND ogur.gid = %d", array($user->uid, $gid));
while ($role = db_fetch_object($result)) {
// Add roles to account first, so we can statically cache all roles
// afterwards.
$account->roles[$role->rid] = $role->name;
$user->roles[$role->rid] = $role->name;
}
// Reload user permissions.
user_access(NULL, $user, TRUE);
}I think edit og_user_roles_init by og_user_roles_user should resolve the bug.
Comments
Comment #1
goz commentedThis not resolve probleme in all cases in fact.
I put this code in a new module in a hook_init function and give module's weight less weight than ucreate module (so -11). This fix the error.
Comment #2
sunCould you try once again with 4.1 ?
Comment #3
sunSorry, without further information this issue can only be marked as won't fix.
Feel free to re-open this issue if you want to provide further information. Thanks.