Loading src/Controller/UserEditController.php +7 −6 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Drupal\disable_user_view\Controller; use Drupal\user\Controller\UserController; use Drupal\user\UserInterface; /** * Controller routines for user routes. Loading @@ -10,18 +11,18 @@ use Drupal\user\Controller\UserController; class UserEditController extends UserController { /** * Redirects users to their profile page. * Redirects users to their profile edit page or the user you are trying to access. * * This controller assumes that it is only invoked for authenticated users. * This is enforced for the 'user.page' route with the '_user_is_logged_in' * requirement. * * @return \Symfony\Component\HttpFoundation\RedirectResponse * Returns a redirect to the profile of the currently logged in user. * Returns a redirect to the profile edit form of the currently logged in * user or the user you are trying to access. */ public function userPage() { return $this->redirect('entity.user.edit_form', [ 'user' => $this->currentUser()->id(), ]); public function userPage(UserInterface $user = NULL) { $uid = !empty($user) ? $user->id() : $this->currentUser()->id(); return $this->redirect('entity.user.edit_form', ['user' => $uid]); } } Loading
src/Controller/UserEditController.php +7 −6 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Drupal\disable_user_view\Controller; use Drupal\user\Controller\UserController; use Drupal\user\UserInterface; /** * Controller routines for user routes. Loading @@ -10,18 +11,18 @@ use Drupal\user\Controller\UserController; class UserEditController extends UserController { /** * Redirects users to their profile page. * Redirects users to their profile edit page or the user you are trying to access. * * This controller assumes that it is only invoked for authenticated users. * This is enforced for the 'user.page' route with the '_user_is_logged_in' * requirement. * * @return \Symfony\Component\HttpFoundation\RedirectResponse * Returns a redirect to the profile of the currently logged in user. * Returns a redirect to the profile edit form of the currently logged in * user or the user you are trying to access. */ public function userPage() { return $this->redirect('entity.user.edit_form', [ 'user' => $this->currentUser()->id(), ]); public function userPage(UserInterface $user = NULL) { $uid = !empty($user) ? $user->id() : $this->currentUser()->id(); return $this->redirect('entity.user.edit_form', ['user' => $uid]); } }