Hi,
1. For the cancel button, the problem is in Joomla. In the file components/com_users/src/Controller/ProfileController.php , near the end of the file, you have the "cancel" function:
public function cancel()
{
// Check for request forgeries.
$this->checkToken();
// Flush the data from the session.
$this->app->setUserState('com_users.edit.profile', null);
// Redirect to user profile.
$this->setRedirect(Route::_('index.php?option=com_users&view=profile', false));
}
This code redirects to the user profile, no matter what.
Ideally, this code should be changed to:
public function cancel()
{
// Check for request forgeries.
$this->checkToken();
// Flush the data from the session.
$this->app->setUserState('com_users.edit.profile', null);
$redirect = $app->getUserState('com_users.edit.profile.redirect');
// Don't redirect to an external URL.
if (!Uri::isInternal($redirect)) {
$redirect = null;
}
if (!$redirect) {
$redirect = 'index.php?option=com_users&view=profile';
}
// Redirect to user profile.
$this->setRedirect(Route::_($redirect, false));
}
The same way this is handled in the save function so that it takes into account the com_users.edit.profile.redirect state which allows 3rd party extensions to redirect back to their page.
2. While I agree that it would be a nice improvements to have, and I have noted this down on our todo list, I don't see why you think this is essential functionality. All the pages work fine without autodetecting the corresponding menu item.