function UserController::userPage

Same name in other branches
  1. 9 core/modules/user/src/Controller/UserController.php \Drupal\user\Controller\UserController::userPage()
  2. 8.9.x core/modules/user/src/Controller/UserController.php \Drupal\user\Controller\UserController::userPage()
  3. 10 core/modules/user/src/Controller/UserController.php \Drupal\user\Controller\UserController::userPage()

Redirects users to their profile page.

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 value

\Symfony\Component\HttpFoundation\RedirectResponse Returns a redirect to the profile of the currently logged in user.

1 string reference to 'UserController::userPage'
user.routing.yml in core/modules/user/user.routing.yml
core/modules/user/user.routing.yml

File

core/modules/user/src/Controller/UserController.php, line 358

Class

UserController
Controller routines for user routes.

Namespace

Drupal\user\Controller

Code

public function userPage() {
    return $this->redirect('entity.user.canonical', [
        'user' => $this->currentUser()
            ->id(),
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.