tags:

views:

235

answers:

1

Hi,

I am trying this in Joomla , but i getting error

Catchable fatal error: Object of class JUser could not be converted to string in C:\xampp\htdocs\Joomla\components\com_jumi\jumi.php(25) : eval()'d code on line 3

A: 

Hi,

Try below instead of your code.

<?php 
  $user =& JFactory::getUser(); 
  print_r($user); 
?>

This will work because the first line will return the object and you are trying to print the object using echo.

If you want to get user name the try below code.

<?php
  global $mainframe;
  $User_name = $mainframe->getuser()->get('name');
?>

above code will return name of the logged in user.

Avinash