hi Every one,
is it possible to get current login user information from joomla to custom php file which also present in joomla root directory i tried but i get error please need urgently...
but i got error/warning..as ...
please help me..
is it possible to get current login user information from joomla to custom php file which also present in joomla root directory i tried but i get error please need urgently...
?php
define( '_JEXEC', 1 );
define('JPATH_BASE', 'D:/xampp/community/' );
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( DS.'includes'.DS.'defines.php' );
require_once ( DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$user =& JFactory::getUser();
echo "user is".$user->username;
but i got error/warning..as ...
Warning: require_once(\includes\defines.php) [function.require-once]: failed to open stream: No such file or directory in D:\xampp\htdocs\community\components\com_booklibrary\mybooks.php on line 9
Fatal error: require_once() [function.require]: Failed opening required '\includes\defines.php' (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\community\components\com_booklibrary\mybooks.php on line 9
please help me..
hm, that wil be interesting to know. but I can't even imagine how to do that. maybe admins will help...
Hi,
This is the code needed:
This is the code needed:
<?php
$user =& JFactory::getUser();
echo "user is ".$user->username;
?>
Hi there!
Just for helping newbies like me, the workaround I got for this was:
1. Open form in FORMS MANAGER.
2. Choose CODE tab
3. Inside the form code, found the INPUT BOX for username
4. Changed a little bit the original code for:
It worked fine.
Thanks again for this great extension.
Cheers from Brazil
Lucas Selbach
Just for helping newbies like me, the workaround I got for this was:
1. Open form in FORMS MANAGER.
2. Choose CODE tab
3. Inside the form code, found the INPUT BOX for username
4. Changed a little bit the original code for:
<input id="user" maxlength="150" size="30" class=" validate['required']" title="user" label_over="0" hide_label="0" type="text" value=<?php
$user =& JFactory::getUser();
echo $user->username;?> name="user" />
It worked fine.
Thanks again for this great extension.
Cheers from Brazil
Lucas Selbach
Hi Lucas,
There's a simpler way that doesn't required you to edit the Form HTML (if you do this then you can no longer use the Preview Box to eidt your form inputs).
Add a Custom Code action to the On Load event, drag it up before the Show HTML action and put this in it
Make sure that the Show HTML action has 'Republish' set to 'Yes' (the default setting).
Bob
PS If you need more User info I have a Load User Info action that will grab it for you.
There's a simpler way that doesn't required you to edit the Form HTML (if you do this then you can no longer use the Preview Box to eidt your form inputs).
Add a Custom Code action to the On Load event, drag it up before the Show HTML action and put this in it
<?php
$user =& JFactory::getUser();
$form->data['user'] = $user->username;
?>
Make sure that the Show HTML action has 'Republish' set to 'Yes' (the default setting).
Bob
PS If you need more User info I have a Load User Info action that will grab it for you.
This topic is locked and no more replies can be posted.