add and remove preassign role to user on completion of user profile I have created user through admin. Admin Assign specific role to user. But On first time login we want user to complete user profile and then only it will able to access anything else on site. So I want to remove role from user profile if any of field in user profile is empty. And add Pre-assign role again to user after completion of user profile.

Please help. Thanks in advance
I never did something similar before, but I guess, rules module suits you like nothing else.

First of all you need 2 roles: users who just created and users who filled some profile fields. When admin creates a new user he set first (just created) role.

Then you create a new page view event (in rules core):


Create action load entity by id using site:current-user token (so you can access user profile fields in condition section);
In condition section, Check user role (only for just created);
In condition section, create condition for each profile field you wanna check (not empty or something similar);
Create action to redirect user to edit profile page.


So, each time when new user will load any site page, he will be redirected to edit profile page until he doesn't fill profile fields.

The second event is after profile save, assign new role "Fills some profile fields".
There is no difficult conditions, so I'm sure you can handle this event yourself.

If you need more complex solution, redirect on profile if only user load specific page you can try rules page. If you would like to redirect only once per session, you have to write your own rules condition through rules API or try out this one (never use this before).

I hope this could be helpfull for you, anyway wish you luck to find what you are really looking for.