1
votes

I am using joomla 1.5.26 .

I can fetch the username and userid within the joomla file structure by

$user =& JFactory::getUser(); $user->username;.

Now I have a file which is neither under template folder nor under module folder nor under component folder. This is simply under root folder.

Now how can I fetch the logged in username?

2

2 Answers

2
votes

Try this one create a new file on home page and access the username in this way

 define( '_JEXEC', 1 );
    define('JPATH_BASE', dirname(__FILE__) );
    require_once( JPATH_BASE .'/includes/defines.php' );
    require_once( JPATH_BASE .'/includes/framework.php' );
    $mainframe =& JFactory::getApplication('site'); 
    $user =& JFactory::getUser();
    $user->username;
-3
votes

You cannot get/access any information if your file is not a type of Joomla! plugins.