Timeline for How update user info using its UID in a custom module?
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 21, 2016 at 19:55 | comment | added | avpaderno♦ |
@Soheyl Using user_load($user->uid) is just an example. In your code you will use the user ID you have, if you have one, or the code shown in this answer, if you need to save a field for the currently logged-in user.
|
|
Aug 21, 2016 at 19:53 | history | edited | avpaderno♦ | CC BY-SA 3.0 |
improved formatting and grammar
|
Aug 18, 2016 at 13:27 | comment | added | Sinf | Thx @mchar I understood :) | |
Aug 18, 2016 at 13:26 | vote | accept | Sinf | ||
Aug 18, 2016 at 13:23 | comment | added | mchar |
Welcome! No, you need the $user->uid to user_load a user and then when you user_save to update the user. The uid is a field attached to the $user entity, do a describe users; to your database and you will see all the available user fields. Thus, we are never getting the user id in the way you mean it, as a single/isolated value, instead, we are getting the user object with all its fields attached (from the db) and we decide to which field(s) to refer to.
|
|
Aug 18, 2016 at 12:33 | comment | added | Sinf | thx for ur answer, just a question, is this line getting the user ID and update it's profile '$account = user_load($user->uid);' ? | |
Aug 18, 2016 at 9:24 | history | answered | mchar | CC BY-SA 3.0 |