Jump to content

Joomla and php


hashkash

Recommended Posts

Hello!
Im using Joomla to develop a portal.Im posting here bcoz i need some help with my php script.
Basically i need to extract the user name of the user that has logged in i.e when he clicks on a link
I would like to retrieve certain information regarding that user.
People have told me that i can get it by a global variable $my->username.
I keep getting REstricted access.Could anyone who has used Joomla please help me
[code]
defined ('_VALID_MOS') or die('Restricted access');
global $my;
echo $my->username;
[/code]
Link to comment
https://forums.phpfreaks.com/topic/31566-joomla-and-php/
Share on other sites

Well, it sounds like the reason you're getting the "Restricted Access Error" is because you're looking for a constant that hasn't been defined. You can't expect to use joomla's session/login information if you don't include all of the neccessary configuration/function files. I'm not exactly sure what exactly that entails but this should get you headed in the right direction:

[code]// Set flag that this is a parent file
define( '_VALID_MOS', 1 );

require( 'globals.php' );
require_once( 'configuration.php' );
require_once( 'includes/joomla.php' );[/code]

You would place that at the top of your code. Make sure all the paths accurate as well.
Link to comment
https://forums.phpfreaks.com/topic/31566-joomla-and-php/#findComment-147934
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.