Hello, I have seen how the "Counter for og_users_roles table " is used an it's a very bad practice that is non atomical :

when a role is assigned to a user for a group the following code is used :

  $ogr_id = variable_get('og_user_roles_counter', 0) + 1;
        variable_set('og_user_roles_counter', $ogr_id);
        db_query("INSERT INTO {og_users_roles} (uid, rid, gid, ogr_id) VALUES (%d, %d, %d, %d)", $uid, $rid, $gid, $ogr_id);

which can lead to have 2 rows with the same $ogr_id if the site is under heavy load.
Why not used an auto-increment field ?

David

Comments

SomebodySysop’s picture

Status: Active » Needs work

Good idea. I'll look into it. Have to figure out how to upgrade existing tables while accomplishing this. Thanks.

TechSteve’s picture

I also doubt about this variable. I'm writing some program to set the user roles on the fly and find that this variable is set when assigning roles to group nodes in the module. However, it seems that the only use is to show the number on the '/admin/og/og_user_roles/settings' page. Is there anybody know why this variable is there or any usage would be implemented in the future? Thanks.

Cheers,
Steve

sun’s picture

Status: Needs work » Closed (won't fix)

With the rise of the rewritten OGUR 4.x for Drupal 6, in which many unrelated features of OGUR were removed, and nearing a release of Drupal 7, I'm closing down old issues.

SomebodySysop’s picture

Status: Closed (won't fix) » Needs work

The person who changed the status of these issues to "won't fix" was not authorized to do so: http://drupal.org/node/352139#comment-2352234

OGUR 6.x-1.x will continue to be maintained by me.