drupal User profile changes
is it possible to get the updated fields wh开发者_Python百科en a user updates his profile.ie If he updates first name and last name then i want that both fields only. Is there any module to fetch the updated modules or any other methods to do this??? Thanks in advance
In a word, no. You might be able to implement such a thing yourself using hook_user() and insert/update $op
s. Doing a similar thing with nodes in hook_nodeapi
you'd call node_load
on the nid
of the node being acted upon, and that would give you the old node, in it's unchanged state (because Drupal does not reset the cache from node_load
until later on. This is apparently by design.
Similarly in hook_user()
you might be able to call user_load()
to get the old user details, run through each of the object's values and compare them against the new user object, telling you exactly what had changed. This totally depends on at what Drupal clears the static cache for the user following an insert/update though. The only way you'll know is by reading the code in the user module or just trying it out.
精彩评论