Advertisement
Guest User

fix for username blank

a guest
Apr 10th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.98 KB | None | 0 0
  1.     public function authorise($itemid)
  2.     {
  3.         $menus  = $this->getMenu();
  4.         $user   = JFactory::getUser();
  5.        
  6.         /* quick fix :) */
  7.         // Joomla base code seems to work but is overridden somewhere -
  8.         // let's reset username
  9.         $table = $user->getTable();
  10.         if($table->load($user->id))
  11.         {
  12.             $original_properties = $table->getProperties();
  13.             if(isset($original_properties['username']))
  14.             {
  15.                 $user->set('username', $original_properties['username']);
  16.             }
  17.         }
  18.         /* End quick fix */
  19.  
  20.         if (!$menus->authorise($itemid))
  21.         {
  22.             if ($user->get('id') == 0)
  23.             {
  24.                 // Redirect to login
  25.                 $uri        = JFactory::getURI();
  26.                 $return     = (string)$uri;
  27.  
  28.                 $this->setUserState('users.login.form.data', array( 'return' => $return ) );
  29.  
  30.                 $url    = 'index.php?option=com_users&view=login';
  31.                 $url    = JRoute::_($url, false);
  32.  
  33.                 $this->redirect($url, JText::_('JGLOBAL_YOU_MUST_LOGIN_FIRST'));
  34.             }
  35.             else {
  36.                 JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
  37.             }
  38.         }
  39.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement