Skip to content

Commit

Permalink
Export additional user data
Browse files Browse the repository at this point in the history
  • Loading branch information
yurabakhtin committed Sep 12, 2024
1 parent 1ee4611 commit 378d022
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use humhub\modules\user\models\Follow;
use humhub\modules\user\models\Group;
use humhub\modules\user\models\Mentioning;
use humhub\modules\user\models\Password;
use humhub\modules\user\models\Session;
use Yii;

Expand Down Expand Up @@ -187,7 +188,9 @@ public static function onLegalModuleUserDataExport(UserDataCollectionEvent $even
{
$event->addExportData('user', UserDefinitions::getUser($event->user));

$event->addExportData('password', UserDefinitions::getPassword($event->user->currentPassword));
$event->addExportData('password', array_map(function ($password) {
return UserDefinitions::getPassword($password);
}, Password::findAll(['user_id' => $event->user->id])));

$event->addExportData('friendship', array_map(function ($friendship) {
return UserDefinitions::getFriendship($friendship);
Expand Down Expand Up @@ -249,10 +252,7 @@ public static function onLegalModuleUserDataExport(UserDataCollectionEvent $even

$event->addExportData('space-membership', array_map(function ($membership) {
return SpaceDefinitions::getSpaceMembership($membership);
}, Membership::find()
->innerJoin('space', 'space.id = space_membership.space_id')
->where(['space.created_by' => $event->user->id])
->all()));
}, Membership::findAll(['user_id' => $event->user->id])));

$files = File::findAll(['created_by' => $event->user->id]);
$event->addExportData('file', array_map(function ($file) {
Expand Down

0 comments on commit 378d022

Please sign in to comment.