Role settings not updated for existing groups

Coyote - September 24, 2007 - 20:09
Project:OG User Roles
Version:5.x-3.7
Component:Code
Category:feature request
Priority:normal
Assigned:SomebodySysop
Status:postponed
Description

I noticed, while fiddling around with an install of this module, that when default roles settings are chosen (default admin role, default group member role, etc) that settings do seem to be retroactively applied to existing groups.

What this means, for instance, is that if I've set a default role for group creators, with special permissions for them (including the ability to "configure member roles"), the creators of existing groups are not assigned to that role, so they are unable to use the capabilities of that role in their own group, and in this example, cannot see the "Configure Member Roles" tab on the subscription settings page.

Editing and re-saving the group does not update this. The only solution I found was to delete the group and create a new one from scratch.

#1

SomebodySysop - September 24, 2007 - 23:57
Category:bug report» feature request
Assigned to:Anonymous» SomebodySysop
Status:active» needs review

Editing and re-saving the group does not update this. The only solution I found was to delete the group and create a new one from scratch.

Not sure why you feel you need to delete the group. Simply adding the group role to the user in the group, and removing the old one would suffice. In any event, you are going to have to manually remove the existing role (if, in fact, you want it removed) if you decide to switch "Founder" roles midstream.

Anyway, this is a feature request, not a bug. The intent was that any changes made retroactively would have to be made manually. But, I didn't think it would hurt to re-insert the "Founder" role when the group is updated, in case your default changes. This will add the new default role, but it won't remove the existing one (since we have no way of a) knowing what that is and b) even if we do know, we don't know if it's been inserted because the user created the group or because you simply wanted the user to have it).

See if this patch will at least add the new Founder group role to existing group creators when the group is updated.

AttachmentSize
og_user_roles.module.5.x-2.5_2.patch 19.97 KB

#2

Coyote - October 1, 2007 - 22:18

Perhaps I was unclear.

I installed OG, and created some groups.

I later installed OG User Roles.

The existing groups did not assign the group's administrator to the role I set up as a founder role via OG User Roles. This meant that various privileges that role granted were unavailable to them. I could not find any way to cause them to be added to that group role within the group.

Basically, what I'm saying, is that groups created before the installation of OG User Roles did not seem to get updated such that existing group members get assigned to the default roles chosen, and that included the admin of the group.

It's possible I might be able to log in as admin, go to the group, and assign everyone the appropriate roles manually, but if someone has a site with a lot of existing groups and members, it seems like that might be a problem.

#3

SomebodySysop - October 1, 2007 - 23:19

Basically, what I'm saying, is that groups created before the installation of OG User Roles did not seem to get updated such that existing group members get assigned to the default roles chosen, and that included the admin of the group.

No, I didn't understand that's what you meant. Hmmm.... Assigning default member and founder group roles retroactively. Seems like some sort of batch edit process.

Open to suggestions.

#4

SomebodySysop - October 11, 2007 - 23:04
Status:needs review» postponed

Needs some more thought.

#5

Jax - October 9, 2009 - 10:31
Version:5.x-2.4» 5.x-3.7

To retroactively assign a founder/administrator role to the existing founder, would it be enough to create the rows in the og_users_roles table?

Also, I don't understand why the ogr_id column isn't an auto_increment column. Could you shed some light on that as well please?

#6

Jax - October 15, 2009 - 20:16

Follow these steps to add all group authors to the og_users_table to retroactively enable the og_user_roles module for them. The number 9 is the id of the role I want to give them.

ALTER TABLE og_users_roles ADD UNIQUE KEY (ogr_id);
ALTER TABLE og_users_roles MODIFY `ogr_id` int(10) unsigned NOT NULL DEFAULT NULL auto_increment;
INSERT INTO og_users_roles (uid, rid, gid)
SELECT n.uid, 9, n.nid FROM og INNER JOIN node n ON og.nid = n.nid
SELECT MAX(ogr_id) FROM og_users_roles;
UPDATE variable SET value = 's:4:"4444";' WHERE name = 'og_user_roles_counter';

 
 

Drupal is a registered trademark of Dries Buytaert.