Created
February 11, 2022 12:20
-
-
Save hissy/1ff637b079551fe5619e545676641ff4 to your computer and use it in GitHub Desktop.
#ConcreteCMS Tiny script to anonymize users
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Concrete\Core\Support\Facade\Application; | |
use Concrete\Core\User\UserInfoRepository; | |
$app = Application::getFacadeApplication(); | |
/** @var UserInfoRepository $repository */ | |
$repository = $app->make(UserInfoRepository::class); | |
$updated = 0; | |
$failed = 0; | |
foreach ($repository->all() as $userInfo) { | |
$uID = $userInfo->getUserID(); | |
$userInfo->setAttribute('profile_private_messages_notification_enabled', false); | |
$result = $userInfo->update([ | |
'uEmail' => sprintf('user%[email protected]', $uID) | |
]); | |
if ($result) { | |
$updated++; | |
} else { | |
$failed++; | |
} | |
} | |
echo sprintf('Anonymize Completed. %d users updated, %d users failed.', $updated, $failed); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment