Modify existing user-based field via a form
I am trying to create a form which allows the submission of a specific user-based field ("sign this") without having the user return to their account page. Since the field is boolean, it creates a table entry every time a user is created. So...
- If the user is no logged in, the form needs to allow the creation of a user (I assume I can show only the essential user account fields).
- If the user is already logged in, the query needs to modify a column based on the currently logged in user.
I think I get how to do 1, though your user module shows mostly how to alter the user form, not create a separate form on a different page that also registers a user. However, i am not sure how to check for an already existing user, and modify the specific field. Any suggestions? Snippets?
Thanks,
Maria
After further investigation, it seems that what I want is the db_update function, where it looks for the 'entity_id' and modifies when the uid matches the entity id. I can see the update function in the trails tutorial. However, what I don't get is how to set it so the first parameter($trail_id) actually looks for the currently logged in user, and sets that as the entity_id that is being updated.