0

I need to assign one custom field value from user profile. One field is nickname (this field is filled by user) and I need to generate another field with function.

The function takes nickname and using external library takes this nicknames ID. I need to run one function and save this ID everytime new profile is saved or existing updated.

I can not find good way to do it.

I tried with Rules module setting event after account updated with action evulate value with php, but there i can not load my api library to do the function.

Any information will help me

1

Have you tried hook_user_presave() ?

https://api.drupal.org/api/drupal/modules!user!user.api.php/function/hook_user_presave/7

You have access to all fields of your new user and can pick up your value, call your custom code and get your new id. Then add it wherever you need to.

Use dpm($account) to inspect your user object.(devel module)

0

Problem was that my module doesnt loaded package. I need to turn off and againt turn on module in modules menu. Now all hooks works. So for everybody. Do it too if hooks doesnt loads.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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