I am working on a module that adds user accounts from an external source with a MENU_CALLBACK function. I have a hidden field that i want to populate with the profile_save_profile function, but am unable to unless it is not hidden because of permissions on the menu callback (i suspect). So...

(1) What permissions does a module run with?
(2) What user does a module run as?
(3) Am I able to change these to make this work inside the core API instead of writing my own query?
(4) Is profile_save_profile the best route to accomplish this?

Thanks!

Comments

nevets’s picture

First off you should be using user_save() if you are creating new accounts. Modules run as the person logged in. As for (3) you would need to provide a lot more detail to be able to answer that.

Jamesh’s picture

The account is being created with user_save(), I can't seem to have it populate the profile fields as it creates the account, so I follow user_save with profile_save_profile() to save the content of the hidden field.

There is no login to this callback. It is an automated process triggered in response to an external event. It works if I make the profile field not hidden.

I am looking for a way to set the id/permissions of the process (since it isn't logged in) so it will satisfy the user_access('administer users') requirement in _profile_get_fields() called by profile_save_profile().