Jump to content

Edit Profile - Direct Link from Menu


Peter Ward

Recommended Posts

I wanted my users to go straight to the edit form for their user profile from the main menu, rather than go via the profile preview page (and then via their profile details page --> too many clicks!). I'm using the Submit Profile menu item type so that new and current users use the same link on the menu.

To do this create a custom override SITE_ROOT/templates/jreviews_overrides/controllers/userprofiles_profiles_controller.php from SITE_ROOT/components/com_jreviews_addons/userprofiles/controllers/userprofiles_profiles_controller.php.

Change lines 41 - 46 from

if($profilePreview = $this->UserprofilesProfile->renderProfilePreview($this->auth->id))
{
    $this->set('profilePreview', $profilePreview);

    return $this->render('profiles', 'create_profile_exists');
}

To this:

if($profilePreview = $this->UserprofilesProfile->renderProfilePreview($this->auth->id))
{
    $listing = $this->UserprofilesProfile->getProfileListing($this->auth->id);
    $Routes = ClassRegistry::getClass('RoutesHelper');
    $editUrl = $Routes->listingEdit('', $listing, ['return_url'=>true]);
    cmsFramework::setSessionVar('referrer', cmsFramework::getCurrentUrl(), 'jreviews.userprofiles');
    cmsFramework::redirect($editUrl, 302);
}

 

Edited by Peter Ward
  • Like 2
Link to comment
×
×
  • Create New...