diff --git a/CHANGELOG.md b/CHANGELOG.md index 95480605..68554dd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ **Merged pull requests:** - Release v2.1.5-2023.06 🎉 +- Redirect to viewprofile.php if profile.php hasn't arguments [\#202](https://github.com/torrentpier/torrentpier-lts/pull/202) ([belomaxorka](https://github.com/belomaxorka)) - Show smilies in post for guests [\#196](https://github.com/torrentpier/torrentpier-lts/pull/196) ([belomaxorka](https://github.com/belomaxorka)) - Added showing PM counter in page title [\#193](https://github.com/torrentpier/torrentpier-lts/pull/193) ([belomaxorka](https://github.com/belomaxorka)) - Corrected translations [\#183](https://github.com/torrentpier/torrentpier-lts/pull/183) ([belomaxorka](https://github.com/belomaxorka)) diff --git a/library/includes/ucp/viewprofile.php b/library/includes/ucp/viewprofile.php index 27a8c869..eb8e6482 100644 --- a/library/includes/ucp/viewprofile.php +++ b/library/includes/ucp/viewprofile.php @@ -8,19 +8,22 @@ $datastore->enqueue(array( 'ranks', )); -if (empty($_GET[POST_USERS_URL]) || $_GET[POST_USERS_URL] == GUEST_UID) -{ - bb_die($lang['NO_USER_ID_SPECIFIED']); -} -if (!$profiledata = get_userdata($_GET[POST_USERS_URL])) -{ - bb_die($lang['NO_USER_ID_SPECIFIED']); -} - if (!$userdata['session_logged_in']) { redirect(LOGIN_URL . "?redirect={$_SERVER['REQUEST_URI']}"); } +else +{ + if (empty($_GET[POST_USERS_URL])) + { + $_GET[POST_USERS_URL] = $userdata['user_id']; + } +} + +if (!$profiledata = get_userdata($_GET[POST_USERS_URL])) +{ + bb_die($lang['NO_USER_ID_SPECIFIED']); +} if (!$ranks = $datastore->get('ranks')) { @@ -220,4 +223,4 @@ if (bf($profiledata['user_opt'], 'user_opt', 'dis_topic')) $user_restriction $template->assign_var('USER_RESTRICTIONS', join('