By rohitp on
'm using drupal_execute to programmatically set up a new user and then assign different roles to that user. Everything works fine if I'm logged in as admin, but triggered from outside without being logged in only works partially. It just creates the user but not assignning the required role to that user.
Seems like a permissions problem, but I couldn't find any example on how to solve it. Any pointers are very much appreciated
Regards,
rohitp
Comments
As mentioned in an earlier question on the same page
global $user; $user = user_load(array('uid' => 1));
drupal_execute function
Hello Thanks for reply
but still only user is created but no roles are going to assigned for particular user,the user is submitted with default anonymous role.need your suggestion.
Updates??
I am trying to do the same. Did you find out how to do this?
Long story short, I am using post data from another site that I want to use to create a user account with a special role "auth_user"
Here is how I am trying to do this:
I have the auth_user variable ther just until I can figure out how if this is the right approach.
Any thoughts?
THX in advance