Hi, while I'm at it, I'll post this one too. It's not really a bug or very important, but I thought I'd share this bit of information. Maybe it could be patched too, or added to the readme.

I noticed that I new users get an db-error on the first page:

User [newusername] was automatically added to your buddy list

user warning: Duplicate entry '17-4' for key 1 query: INSERT INTO dp_users_roles (uid, rid) VALUES (17, 4) in [pathtohtdocs]/includes/database.mysqli.inc on line 151.

It doesn't stop the registration or page loading, but it looks a bit ugly, not something I want users to see.

I tested a bit, and seems this is caused by og_user_roles trying to add a role to the new user... but the user already had the role, which in my case was given by the module "Auto Assign Role". The only purpose of "Auto Assign Role" is to assign some role to all new users.. so it's quite logical that I should either disable that module, or disable the setting for a new role in og_user_roles-settings.

If you want new registrants to get another role, make sure that the role in "Auto Assign Role" and that role in og_user_roles-settings are not the same one.

I believe this error wouldn't happen if the code assigning the role would first check if the user already had this role, and not apply it if it was already. I guess a note in the readme would probably do the job aswell.

Comments

somebodysysop’s picture

Assigned: Unassigned » somebodysysop

You sure about this? OG User Roles by definition does not add roles to the users_role table. The module creates it's own og_users_roles tables and ONLY adds roles to it.

There is only one place where it inserts a role into the "users_roles" table, and that is if you are using the OG User Roles setting "Set default global role for new signuups?".

Now, what this may be is that you can't use both OG User Roles and another module to assign the same site-wide default role to a user on signup?

bibo’s picture

Sorry, I wasn't very clear with my previous post. Yes, what I ment was exactly the "new global role on signup"-setting in og_user_roles. Which in combination with Auto Assing Role-module resulted in the modules trying to add a role that was allready declared by another module (or possibly og_user_roles added the role first, doesn't matter). This caused the mysql error, because the user role table shouldnt have duplicate user-role combinations.

Uninstalling Auto Assign Role fixed this for me, so this "task" is not really a task but some information, for other users and developers :)

somebodysysop’s picture

Again, maybe I'm not following this correctly, but it seems to me that the better solution is simply to leave the "Default Non-Group Role for new users" setting in OG User Roles UN-checked. That way, you can still use the Auto Assign module if needed.

bibo’s picture

Well, either way. I chose to keep the og_user_roles settings, so I can skip using the other module, which doesn't do anything else.

somebodysysop’s picture

Status: Active » Fixed

OK. Added note to README.

Anonymous’s picture

Status: Fixed » Closed (fixed)