Keyword

Simple Improvements to "User Blog" view

  • Geraint Wyn Edwards
  • Geraint Wyn Edwards's Avatar Topic Author
  • Offline
  • New Member
More
15 years 1 month ago #73990 by Geraint Wyn Edwards
Simple Improvements to "User Blog" view was created by Geraint Wyn Edwards
Why not have a "My Page" menu item?

Registered users when logged in can view their own page.

Implementation:
1. Select no user in the menu item
2. Change the logic slightly in components/com_k2/views/itemlist/view.html.php

where you have
case 'user':
//Get user
$id = JRequest::getInt('id');
$user = &JFactory::getUser($id);


change this to

//Get user
$id = JRequest::getInt('id');
// gwe mod
if ($id>0) $user = &JFactory::getUser($id);
else {
$user = &JFactory::getUser();
if ($user->id==0) {
JError::raiseError(404, JText::_('Please log in'));
}
JRequest::setVar('id', $user->id);
}
// end gwe mod


and hey presto

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum