Skip to content
Snippets Groups Projects
Commit 82b80a69 authored by ben25's avatar ben25 Committed by Chris Green
Browse files

Issue #3537207 by devkinetic, ben25, nadim hossain, cafuego:...

Issue #3537207 by devkinetic, ben25, nadim hossain, cafuego: $entity->getOriginal() is only available in D11'
parent dd71e66d
No related branches found
No related tags found
1 merge request!44#3537207 - check original entity correctly within the hook_presave.
Pipeline #561261 passed
......@@ -54,6 +54,8 @@ include:
variables:
_CSPELL_WORDS: 'erikwebb, greggles, knaddison, shelane, joegraduate, tadean, trackleft2'
RUN_JOB_UPGRADE_STATUS: '1'
OPT_IN_TEST_CURRENT: '1'
OPT_IN_TEST_PREVIOUS_MAJOR: '1'
OPT_IN_TEST_NEXT_MINOR: '1'
OPT_IN_TEST_NEXT_MAJOR: '1'
......
......@@ -15,6 +15,7 @@ use Drupal\Core\Url;
use Drupal\user\Entity\User;
use Drupal\user\RoleInterface;
use Drupal\Component\Render\PlainTextOutput;
use Drupal\Component\Utility\DeprecationHelper;
/**
* Implements hook_help().
......@@ -474,8 +475,14 @@ function user_expire_mail($key, &$message, $params): void {
* not re-blocked by the next cron run.
*/
function user_expire_user_presave(User $account) {
$original = $account->getOriginal();
if ($original && $original->isBlocked() && $account->isActive()) {
$original = DeprecationHelper::backwardsCompatibleCall(
\Drupal::VERSION,
'11.2.0',
fn() => $account->getOriginal(),
fn() => $account->original,
);
if (!empty($original) && $original->isBlocked() && $account->isActive()) {
$account->setLastAccessTime(\Drupal::time()->getRequestTime());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment