1

My client has a user field field_geolocation of type Geofield.

And he has a content type issue, he allows people to create new issues (kinda like in drupal.org but private).

What he wants is: When someone is creating a new issue, he should be able to to set/edit the field in his profile identified by field_geolocation.

My guess: create a custom module which does the following

  • Inject a widget for the user field field_geolocation inside the node add/edit form, prbably with FAPI
  • Use Node API to save the data collected previously into the actual user.

Did I guess right? Or any better solutions?

Thank you.

2

You're on the right track. It should be a pretty straight forward thing to implement.

I would add a custom submit handler to the node form for your issue content type. Grab the submitted values for the geolocation field. Load the user using user_load(), if the value has changed, the update it and call user_save().

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.