Problem/Motivation
The social_user_export module gives the ability to export all users over all pages on /admin/people. The code for that functionality is in src/ExportUser.php. It uses the uid to determine the next user to export in the batch. However this does not work when the view query is already altered in another hook. For example with the following code:
<?php
/**
* Implements hook_views_query_alter().
*
* Make sure we filter out user 1 from the people overview.
*/
function mymodule_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {
if ($view->id() == 'user_admin_people') {
foreach ($query->where as &$condition_group) {
foreach ($condition_group['conditions'] as &$condition) {
// Make sure we filter out AN users and User 1 for SaaS customers on
// the admin/people overview.
if ($condition['field'] == 'users_field_data.uid') {
$condition = array(
'field' => 'users_field_data.uid',
'value' => '1',
'operator' => '>',
);
}
}
}
}
}
?>
Then you will end up with a .csv file with the same user exported multiple times.
Proposed resolution
If we use the offset method instead this is much more robust and should not have any downside. This means we can also remove a few lines of code used to set and retrieve the current_id in the $context array.
$view->setOffset($context['sandbox']['progress']);
Comments
Comment #2
jaapjan commentedhttps://github.com/goalgorilla/open_social/pull/774
Comment #4
jaapjan commented