If I have a role i.e. Member. How to set 'Member' as a default role for the users after they registered yourself ? Please help. Thanks
4 Answers
Can you not do this through Rules?
Event: After saving a new User account
Condition:
Action: Add User role > [account] - Member
-
-
It should come as default, since the rule knows you are dealing with a User account, it should create a token for the new user account (are you using the Token module?) Sep 22, 2014 at 9:25
-
-
It should come as default then, if you've set it up as I've indicated (as I've just tested) it offers you the new users account as the default token. If not, go to the data selector, and select 'account (registered user)' Sep 22, 2014 at 9:33
-
Its not working.. I just create a role i.e. Member, Create a rule & a/c & check through admin that what the role shows in front of that user but it doesn't show Member...– NishantSep 22, 2014 at 9:38
Use Auto Assign Role module to set a default role at the time of user registration.
You can also use registration_role module to fulfill your requirement.
-
Thanks @Smalution.. Is there any other way to solve this without any module installation...– NishantSep 22, 2014 at 8:05
-
-
I know about the custom hook.. Thanks @Smalution.. I think only through these two way, no any other way to solve this.. Am I right..???– NishantSep 22, 2014 at 8:12
-
Currently i do not know any other ways if you find any new way please update here.– DRUPWAYSep 22, 2014 at 8:18
-
1Through Rules.. We can create "Member" as default role.. Its very easiest way...– NishantSep 22, 2014 at 12:41
It is always recommended to use contributed module instead of writing a custom module if it is in stable release and fulfills your requirements. Auto Assign Role is exact solution of your problem.
- Install the module.
- Go to Configuration->People-> Auto Assign roles.
- Click on Automatic Assignment.
- Select your default role. (Member in your case)
- Click on save.
Bingo!
-
Thanks.. but what about existing users... If they are assigned as "authenticate" then how can I assign those as "Member" @Xeeshan– NishantSep 22, 2014 at 12:38
-
For existing users, you can write a SQL script to update all existing users and assign them "Member" role as well. (User will have both roles member & authenticated Users).– XeeshanSep 22, 2014 at 13:05
-
If you are don't want to write SQL script, you can use View Bulk Operation Module to update existing user roles using user interface.– XeeshanSep 22, 2014 at 13:07
click edit column on People page on specific user who will have role Member, and tick Memeber checkbox on that edit page.