hook_crowd_presync_user_data() is used to implement any local sync tasks that may be needed before native syncs take place. A common thing to do there is to make custom changes to the local user object based on crowd data (populate local first/last name fields, etc.). Though the account object is available in this hook, it's best not to alter that directly, so current best practice is to call user_save() directly as part of the hook. This is fine, but it seems a little redundant given that user_save() is called by the module almost immediately after hook_crowd_presync_user_data() is invoked. A better way would be to expose an $edit variable in the hook, and then carry that through to the sequential user_save() that follows. This would make the hook a bit more flexible and performant.
Comment | File | Size | Author |
---|---|---|---|
#2 | juicebox-allow_edit_in_presync_hook-2653110-2.patch | 2.72 KB | rjacobs |
|
Comments
Comment #2
rjacobs CreditAttribution: rjacobs at Center for Research Libraries commentedHere we go.
Comment #4
rjacobs CreditAttribution: rjacobs at Center for Research Libraries commentedCommitted.