Hi there,

I've just got OGUR set up with Drupal 6 and it seems that my member roles aren't taking effect. When I tick "admin" under the "Configure member roles" for user "bob", "bob" doesn't have the "admin" permissions (he can't edit a page). If I go to his user page and make "bob" and "admin" then he does have the admin permissions (he can edit a page).

Also when I save the member roles page I get the following errors in the error log;

Missing argument 2 for og_user_roles_mail_alter() in /home/ubu/public_html/sites/all/modules/og_user_roles/og_user_roles.module on line 3769.

Missing argument 3 for og_user_roles_mail_alter() in /home/ubu/public_html/sites/all/modules/og_user_roles/og_user_roles.module on line 3769.

Missing argument 4 for og_user_roles_mail_alter() in /home/ubu/public_html/sites/all/modules/og_user_roles/og_user_roles.module on line 3769.

Missing argument 5 for og_user_roles_mail_alter() in /home/ubu/public_html/sites/all/modules/og_user_roles/og_user_roles.module on line 3769.

Missing argument 6 for og_user_roles_mail_alter() in /home/ubu/public_html/sites/all/modules/og_user_roles/og_user_roles.module on line 3769.

Any ideas?

Comments

benorgan’s picture

Actually it seems the errors only occur sometimes when I try to save the member roles form. When the errors occur the settings don't get saved.

Perhaps these are two different issues?

benorgan’s picture

Is the cache problem (http://drupal.org/node/286798) still an issue with Drupal 6? I guess it could be to do with this?

somebodysysop’s picture

Is the cache problem (http://drupal.org/node/286798) still an issue with Drupal 6? I guess it could be to do with this?

Yes.

You must enable: "Clear the cache" option. No patch is necessary as this functionality is now a part of Drupal 6.

benorgan’s picture

Hm, I've ticked the "Clear cache" box and saved and then I still get the same problem.

Access denied
You are not authorized to access this page.

This is when I assign a "member role" that should be able to edit the page.. Any idea how to go about troubleshooting?

somebodysysop’s picture

Also when I save the member roles page I get the following errors in the error log;

Missing argument 2 for og_user_roles_mail_alter() in /home/ubu/public_html/sites/all/modules/og_user_roles/og_user_roles.module on line 3769.

Separate issue. Looks like I added a undocumented feature using hook_mail_alter and Drupal changed the syntax. Thanks, guys!

Please create new issue for this.

somebodysysop’s picture

Assigned: Unassigned » somebodysysop

Hm, I've ticked the "Clear cache" box and saved and then I still get the same problem.

Access denied
You are not authorized to access this page.

This is when I assign a "member role" that should be able to edit the page.. Any idea how to go about troubleshooting?

I am able to duplicate it. It appears to have cropped up in one of the recent security updates.

Can you see if weighting OGUR heavier than all your other modules resolves it? I'm troubleshooting on this end as well.

PaulRays’s picture

I got this as well with 6.x .. just to confirm checked out Drupal 5.11 with og_user_roles 5.x-3.3. Same issue

Activated the default roles for group admin, but that does not seem to take effect. However, default group member role does take effect. Tried to activating through 'configure member roles' where checked on groupadmin role to give higher privileges but saving it selected does not actually save it. However, if I uncheck the default member role then that takes effect and I am able to check it back again.

Thanks in advance for any leads while I continue to look

benorgan’s picture

New issue created for the errors in the error log upon save; http://drupal.org/node/325559

benorgan’s picture

I've set the weight to be higher than any other module and the problem still occurs;

UPDATE `ubu_drupal`.`system` SET `weight` = '9999' WHERE CONVERT( `system`.`filename` USING utf8 ) = 'sites/all/modules/og_user_roles/og_user_roles.module' LIMIT 1 ;

somebodysysop’s picture

@PaulRays: This issue thread is for 6.x, not 5.x. Please see below on project page. If your problem persists, please open new issue.

If your basic "OG User Roles aren't working", please note the following:
It appears that the Drupal caching mechanism is used much more stringently as a result of either 5.7 core or OG 5.x-7.x changes. Assuming OGUR has been installed correctly, this may result in group roles you've assigned to group users not being respected when they should (i.e., when they are in group context). In this case, the solution is to implement the "Clear the Cache" setting in OGUR: http://drupal.org/node/263944.

somebodysysop’s picture

@benorgan:

I'm tracking down the issue now. Could you try disabling other non-essential contrib modules to see if that makes a difference. I do know that the 6.x version of OGUR was working correctly as of the earlier Drupal 6.x releases.

The roles in the user object are correct. The problem is with the call to "module_invoke()". One or more modules is returning "false" instead of "null".

Forum topic posted here: http://drupal.org/node/325437

somebodysysop’s picture

Still working on this. I know what's happening, but not why. The cached permissions aren't being flushed with the new ones.

A very *temporary emergency* solution is to override the caching of permissions. This by modifying the user_access() function of the user.module and changing this code:

  if ($reset) {
    unset($perm);
  }

to this

//  if ($reset) {
    unset($perm);
//  }

I don't like modifying core any more than the next person, but until I can find out why the "reset" mechanism isn't working as it did in 5.x, this is the only way I can see right now to get OGUR working in 6.x. Open to any other suggestions.

PaulRays’s picture

Thanks .. I had already applied the clear the cache patch and setting as per http://drupal.org/node/263944. Will retry the whole setup again and if it still does not work will post a new issue for 5.x . I think it may be something to do with 5.11 as it was working earlier for me with 5.8.

somebodysysop’s picture

Got it! In my case, I had tac_lite installed. I un-installed it, and OGUR began working normally.

I'm told on the developer's list that module_invoke() is sometimes not used correctly by contrib modules. In my case, tac_lite appears to be returning a false negative.

If you have tac_lite installed, that's it. If not, try uninstalling non-essential modules until you locate the offender.

Need to now figure out what to do about it since I need taxonomy_access.

benorgan’s picture

I've commented out the two lines in user.module so $perm is always unset, but it still doesn't seem to be working (even after clearing cache). Is there something else I need to do before it will work?

I'll try disabling all contrib modules in turn, but it's a bit worrying that commenting out those lines didn't make it work for me like it did for you.

benorgan’s picture

I've disabled all the contrib modules and it works, slowly working my way through them to work out which one is causing the problem.

benorgan’s picture

Found it. It was the menu_breadcrumb module (http://drupal.org/project/menu_breadcrumb). Any ideas why this would be causing problems? I could possibly do without this on my site but I would like to keep it.

benorgan’s picture

OK I think I can get away without menu_breadcrumb, however, Tiny Tiny MCE is behaving strangely. It doesn't seem to be picking up the permissions set by OGUR. I only want group admins to be able to use Tiny Tiny MCE, but unless I give the user the admin role permenantly Tiny Tiny MCE doesn't show up on the edit page.

somebodysysop’s picture

Once I figure out why tac_lite was causing the problem, I should have a more clear picture of how fixable this is. I know it occurs when any module calls "module_invoke()". That means the problem will be in the offending modules hook_access function.

benorgan’s picture

The Tiny Tiny MCE problem still happens even when all the other contrib modules are disabled (except Tiny Tiny MCE, obviously). This suggests it's a problem with Tiny Tiny MCE. However, I also can't see "File attachments" (which is part of a core Drupal module) unless I explicitly give the user the group admin role for the whole site, suggesting it's something to do with the OGUR code?

somebodysysop’s picture

With respect to menu_breadcrumb.module, that issue is resolved by weighting the module higher than OGUR.

somebodysysop’s picture

With respect to file attchments, I gave (in my setup) Group Contributor (the only group user who can create group content) the OGUR "view file uploads" and "upload file" permissions. This user is able to do both. Created public page with file attachment.

Anonymous user could access group page (because it was public), but could not access file (because anonymous user's don't have "view file uploads" permission). Gave anonymous user this permission and he can now see file.

In short, at this point, OGUR appears to work correctly with Drupal core upload.module. I see no issues with OGUR and file attachments so long as the permissions are correctly applied.

Will look into TinyMCE issue. Also still unable to figure out why OGUR won't work with tac_lite. Not too concerned about this since it was never designed to work with tac_lite, only Taxonomy Access Control, which I've not tested yet.

benorgan’s picture

I've just discovered that if I manually assign the role (using "configure member roles") rather than let OGUR assign it automatically, it works perfectly. File uploads and Tiny Tiny MCE both work as they should.

I guess the next question is why doesn't the automatic assignment work (although that's not such a critical problem in my case).

somebodysysop’s picture

Again, please give some details. OGUR provides several auto role assignments. I've testing one, "Set default basic group (group limited) role for users who join groups of this type: Group?" and it's working fine.

benorgan’s picture

Sorry. I have 4 roles (on top of the standard ones) for my site. Only "group admin" is assignable. The only box I am checking in admin/og/og_user_roles is "Default Group Role for new group administrator" and setting the role to "group admin". All other boxes (except the one to enable a logo) are unchecked.

Then when I make a user a group admin (using the normal OG member list) it lets them edit the page but doesn't show "File attachements" or the Tiny Tiny MCE editor. I also can't manually check the "group admin" box in "configure member roles". If I uncheck the "Default Group Role for new group administrator" box in admin/og/og_user_roles then the "configure member roles" preferences are saved and my user has the right permissions (can attach files and use Tiny Tiny MCE).

Please let me know if you need any clarification.

bejam’s picture

I haven't got menu breadcrumbs of tac_lite installed but am still getting:

Missing argument 2 for og_user_roles_mail_alter() in /home/ubu/public_html/sites/all/modules/og_user_roles/og_user_roles.module on line 3769

I have tried both enabling the clear cache in the og_user_roles config and the user.module hack. Have also tried given og_user_roles a weight of -1 (lots of other mods weighted at 0) - and still no joy!

somebodysysop’s picture

@bejam: Please see #8.

jide’s picture

I discovered that Administration menu module prevents OGUR from working. Whatever role has access to Administration menu. Disabling Administration menu makes OGUR works fine.

jide’s picture

To fix the problem with Administration menu, do the same as for menu_breadcrumb :

db_query("UPDATE {system} SET weight = 9999 WHERE name = 'admin_menu'");

Adding a low weight to OGUR on install could fix the problems with other modules.

jide’s picture

Some other problematic modules i found :

Content Permissions
Localization client

somebodysysop’s picture

Status: Active » Needs review

OK, I think I've found it.

There is a bug in user_access function: http://drupal.org/node/329646

This bug prevents the permissions cache reset mechanism from working properly, hence the system is not displaying the user's actual roles.

Resolved in 6.x with this patch: http://drupal.org/files/issues/329646-user-module-reset-d6.patch

This patch is for the Drupal 6.x user.module.

Apply this patch, and the OGUR member roles problem should go away.

benorgan’s picture

Hi there,

I've applied the patch and cleared the OGUR cache but it still seems to be the same as before, when I tick the box to automatically assign "group admin" to group administrators the role isn't assigned when I make a user a group administrator and the ticks in the boxes on "configure member roles" aren't saved.

Is there something else I should be doing?

Regards,

Ben

somebodysysop’s picture

I've applied the patch and cleared the OGUR cache but it still seems to be the same as before, when I tick the box to automatically assign "group admin" to group administrators the role isn't assigned when I make a user a group administrator and the ticks in the boxes on "configure member roles" aren't saved.

Is there something else I should be doing?

Yes. You should read the comments in these issue queues more carefully. The patch mentioned in #31 is specifically for the issue of member roles not working, period.

It appears that there were three problems brought up in this queue:

1. The initial problem: "Missing argument 6 for og_user_roles_mail_alter()" error in log. See #8. This was resolved in a separate thread: http://drupal.org/node/325559#comment-1076055

2. "Default basic role for admin not working". See #7. That was also resolved in the new thread above: http://drupal.org/node/325559#comment-1092909

3. "Member roles not working at all". See #4. That is resolved with the patch here in this thread at #31.

The whole point of having separate queues is to address and resolve individual problems separately. Trying to resolve multiple, unrelated problems in a single issue thread makes problem resolution much more difficult -- and confusing.

somebodysysop’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

outinsun’s picture

I have applied the patch in question, but user roles is still not working correctly for me with Drupal 6.6. I created a role called "blog author", and give it permission to create blog entries. I set clear cache to true in user role configuration. I created a user called sally and made her a blog author within a group using Configure Member Roles. When she logs in, she doesn't get a "Create Content" menu until she goes to the group page, in which case the "Create Content" links leads to "Access Denied". If I grant some other kind of content creation (such as forum topics) to authenticated users, then sally is allowed to create forum topics both globally, and on the content creation page within the group (no longer getting access denied, but still not getting the right to create a blog entry).