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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.