user.changeRole:before $user, $role /site/config/config.php return [ 'hooks' => [ 'user.changeRole:before' => function ($user, $role) { // your code goes here } ] ]