I have created some roles and these role's user also can create certain type of user.so how to know who is creator i.e, user author name.

2 Answers 2


By default Drupal don't save anything about who create a user.
If you want do it, go to user account fields admin/config/people/accounts/fields add entity_reference with select list widget, then in your custom module in hook_form_alter set default value for field with get current user uid and then hide it there, in this manner the current user id (the user that create user) saved in fields without he/she know that this, also you can dont use hook_form_alter just get $user->uid(the current user that create user ) form global $user in hook_user_insert


  • add a entity reference field to user save creator uid in

  • hook_form_alter when or hook_user_insert


You can add a new text/entity_reference field in User and save current user in hook_user_presave.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.