Feature #2887
openUpdating userIds and streamNames
0%
Description
We have implemented the following methods:
Users::updateUserIds($updates) // fires "after" hook named "Users/updateUserIds" Streams::updateStreamNames($publisherId, $streamNames); // fires "after" hook named "Streams/updateStreamNames"
Plugins add handlers to these hooks, such as:
Streams_after_Users_updateUserIds Assets_after_Users_updateUserIds Assets_after_Streams_updateStreamNames
We need to make similar handlers for the other plugins:
Websites Places Calendars Communities Media Travel
Basically, these handlers are supposed to make the corresponding updates in the database tables (rows and streams, etc.) that these plugins are responsible for. Check how these handlers do it, and do the same there. (For example, any field that could hold a userId should be updated).
In the future: merging¶
Note that these updates can change the user IDs and streamNames in bulk, but if you are trying to "merge" them into existing ones, it will throw an error. The accumulateErrors
parameter can be set to true, and then the functions should accumulate errors to return. This functionality is designed for merging.
For example, if a user signs up with an email address, then another user signs up with a mobile number, there might be a possibility to merge the users and all their information in the database, into one user. This process would call:
$errors = Users::updateUserIds(array( $oldUserId => $newUserId )); foreach ($errors as $e) { $params = $e->params(); $query = $params['query']; $className = $query->className; call_user_func( array($className, 'mergeUser'), array($query->criteria) ) }
And then it
Updated by Gregory Magarshak almost 2 years ago
- Project changed from 101 to Qbix-Beginners
- Category changed from 6 to Qbix Maintenance