public function clearSectionNavigationPreference($url = '', $userID = '', $resetSectionPreference = true)
{
if (!$userID) {
$userID = Gdn::session()->UserID;
}
if ($url == '') {
$url = Gdn::request()->url();
}
$user = $this->getID($userID);
$preferences = val('Preferences', $user, []);
$landingPages = val('DashboardNav.SectionLandingPages', $preferences, []);
// Run through the user's saved landing page per section and if the url matches the passed url,
// remove that preference.
foreach ($landingPages as $section => $landingPage) {
$url = strtolower(trim($url, '/'));
$landingPage = strtolower(trim($landingPage, '/'));
if ($url == $landingPage || stringEndsWith($url, $landingPage)) {
unset($landingPages[$section]);
}
}
$this->savePreference($userID, 'DashboardNav.SectionLandingPages', $landingPages);
if ($resetSectionPreference) {
$this->savePreference($userID, 'DashboardNav.DashboardLandingPage', '');
}
}