1.20.x user.pages.inc | user_page() |
Page callback: Displays the user page.
Displays user profile if user is logged in, or login form for anonymous users.
Return value
A render array for either a user profile or a login form.:
See also
File
- modules/
user/ user.pages.inc, line 576 - User page callback file for the user module.
Code
function user_page() {
global $user;
// To help users upgrading from versions of Backdrop prior to 1.9.0 where this
// menu callback was used on 'user/login' as well as 'user', rebuild the
// menu automatically if this page is loaded at 'user/login'.
// See https://github.com/backdrop/backdrop-issues/issues/260.
if ($_GET['q'] === 'user/login') {
menu_rebuild();
}
if ($user->uid) {
backdrop_goto('user/' . $user->uid);
}
else {
backdrop_goto('user/login');
}
}