I am looking for solution to show the url with username. I am using Joomla 3.3.0 stable version.
Ex. site_url/userp-username
I tried to solve this using .htaccess with following rules that I have used for my core PHP websites.
RewriteRule ^userp-([a-zA-Z0-9-_]+)/?$ site_url/index.php?option ... er_name=$1 [R=301,L]
When I hit the url for example http://sitename.com/userp-vishal07 it execute the code that I want to call for this url and it shows the results correctly. But url does not remain as it is and turn into http://vicciivital.com/index.php/en/component/users/profile?layout=view_profile&user_name=vishal07
I am not able to understand how the Joomla redirect works. Please correct me if I am doing any mistakes here.
For reasons I have never understood the com_users router does not route any profiles except the users own profile.
/**
* Method to get a route configuration for the profile view.
*
* @return mixed Integer menu id on success, null on failure.
* @since 1.6
*/
public static function getProfileRoute()
{
// Get the items.
$items = self::getItems();
$itemid = null;
// Search for a suitable menu id.
//Menu link can only go to users own profile.
foreach ($items as $item)
{
if (isset($item->query['view']) && $item->query['view'] === 'profile')
{
$itemid = $item->id;
break;
}
}
return $itemid;
}
What you would need to do is extend this method to handle everyone's profiles. Just make sure to deal with the situation that there is a content item or tag with the same alias as the alias for the user.
In general the easiest workaround is to use com_contact as a profile instead. Turning on the contact creator plugin will create contacts for your new users automatically and contact can display anything from a profile plugin. Also it can display articles by the user and then you can also add plugins for other things if you want. To me it always works a lot better then messing with the com_users profile.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.