Jump to content

Joomla: get user info from a subdirectory of joomla.


JMair

Recommended Posts

Inside the shared_docs are folders named after teachers. These folders are shared and are mounted drives to the teacher. Anything they put into that drive is then shared on the site. Inside their folder is an index.php that displays everything in their folder. I would like to be able to add addition features for the teachers if they log into the site, however, I'm unable to retrieve the joomla login info from this location. I can from the www folder, but not further in..

 

How can I get that info from somewhere else in the site?

Untitled1.jpg

 

 

here's an example of what works from www root, but not from any other directory.


<?php
//GET JOOMLA USERNAME
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__) );
define( 'DS', DIRECTORY_SEPARATOR );

require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();

$mainframe->route();

$user =& JFactory::getUser();
//gets and shows the joomla login users ID if they are logged into the joomla website.
echo $user->get('id');

?>

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.