Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

How to auto assign a new user to groups after registeration.

  • nightlight
  • nightlight's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 5 months ago #233717 by nightlight
Your LimeSurvey version: LimeSurvey Community Edition Version 5.3.6+220321
Own server or LimeSurvey hosting: Own server
Survey theme/template: fruity and extend
==================
I'm using LDAP plugins to register new user and it working very well. My problem is all new user cannot give permission in survey permission because new user has no group and they cannot see other user on survey site.

I've find the option to auto assign group on general option and LDAP plugin but no luck. I'm  manual add new user to group.

If it already have that option, please give me some advice. Thank you.

Please Log in to join the conversation.

More
1 year 3 months ago - 1 year 3 months ago #239749 by MMAA68
Hi Nightlight,

I have the same problem. It seems that the solution is to create our own plugin but as I not familiar with this, I created a trigger in the mysql database.

On our site, we have a group (guid : 3 name :Everybody).
We want to add new user to this group by default.
Here is a trigger :

DELIMITER $$
DROP TRIGGER lime_users_after_insert;
CREATE TRIGGER lime_users_after_insert
AFTER INSERT ON lime_users FOR EACH ROW
BEGIN
IF (SELECT COUNT(*) FROM limedb.lime_user_in_groups WHERE uid=NEW.uid and guid = 3) = 0 THEN
INSERT INTO limedb.lime_user_in_groups VALUES (3,NEW.uid);
END IF;
END $$

This script must to be adapted as follow, replace
guid = 3
VALUES (3,NEW.uid)
with the default group number you want to give.
To list all the existing groups and find the group number : SELECT * FROM limedb.lime_user_groups;
the ugid column indicates the number of existing groups, name column the name of each group.
 
Regards

Denis
Last edit: 1 year 3 months ago by MMAA68.

Please Log in to join the conversation.

More
1 year 3 months ago #239795 by MMAA68
In fact, there is an error in the query, The column is not named guid but ugid. 
IF (SELECT COUNT(*) FROM limedb.lime_user_in_groups WHERE uid=NEW.uid and ugid = 3) = 0 THEN
3 must also be changed with the group number according your on site.

Regards

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose