Sunday, 21 March 2010 20:38

UPDATE: It turns out this was an issue with JomSocial Registration Redirector, found at http://www.joomlaxi.com/products/free-products/jom-social-registration-redirector.html and NOT JomSocial. The original article is preserved below...


I've been having "fun" assisting in maintaining a site using JomSocial, and recently ran across an interesting issue. The search engine friendly URLs created for JomSocial by JRoute were not being created properly for links under the Profile tab: changeAvatar, editDetails, etc. All of these links would just redirect to the Profile page. After fiddling around with the settings, ensuring the component was up to date, and double checking the .htaccess, I reasoned that it must be a bug in the router.php. After slogging through the code, I managed to find a fix.

The configuration on this site has SEO > URL Format set to "/username/features" and SEO > SEF Compatibility Fix set to "no", in case that makes a difference.

In the CommunityBuildRoute function in JomSocial's router.php, there is a conditional that checks the SEF settings:

if($config->get('sef') == 'feature')
{
}
else
{
...

Inside the "else" statement, there is a second conditional that determines if "userid" is a key in the $query:

if(array_key_exists( 'userid', $query))
{
...

At the end of this conditional, I added an "else" statement to set the 'userid' if the view is "profile", as that is necessary. If you're following along, change this:

if(array_key_exists( 'userid', $query))
{
  ...
  unset($query['userid']);
}

to this:

if(array_key_exists( 'userid', $query))
{
  ...
  unset($query['userid']);
}
else if( array_key_exists( 'view', $query ) && 'profile' == @$query['view'] )
{
  $user       = JFactory::getUser();
  $segments[] = $user->username;
}

This solved the issue on the site I was working on; your mileage may vary as far as how well it works for you!

Last Updated on Sunday, 28 March 2010 20:38
 
Comments (3)
1 Tuesday, 15 June 2010 04:17
J-P
Nope, didn't work. But my problem is quite opposite. My link to profile redirects to edit profile. And I think this problem is caused by Joomlaxi redirect edit to profile, not registration redirector.
I noticed however that this problem appears only when redirect to edit profile redirects links. So only after login when you haven't fill required fields in profile. After that when you logout and login link to profile works well.
2 Wednesday, 27 June 2012 02:03
kavita yeole
Didn't work But My query is that, whenever I click on the user it shows username/profile in the url. I want to remove profile name from the url.

For ex : currently my url look like jum_11/networking/john/profile

and I want to make it like jum_11/networking/john/profile.

Thanks in advance
3 Wednesday, 27 June 2012 02:05
kavita yeole
Sorry I made a little mistake.
I want to make my url look like jum_11/john

Add your comment

Your name:
Comment:
  The word for verification. Lowercase letters only with no spaces.
Word verification:

The Joomla!® name is used under a limited license from Open Source Matters in the United States and other countries. Jeff Channell is not affiliated with or endorsed by Open Source Matters or the Joomla!® Project.

Santorum
Joomla Extensions