JOS_USERS [ Coding Help Please ]
Moderators: tjay, seadap, Rogue4ngel, matthewhayashida
JOS_USERS [ Coding Help Please ]
Hi,
First off I am using 1.0.12 currently. I will upgrade to 1.5 when it is production stable.
Currently I need to access jos_users from the joomla database. I know a little about programming suchs as sessions, which I thought might work, I have also looked at mainframe->getUser a little however I cannot seem to get this working.
I create my php file and load it into joomla using a wrapper.
How can I get the currently logged in users name, id, or email? Anything would be good. If the user it not registerd sent directly to registration form. Initially I thought this would be easy using sessions however I guessed wrong.
Also I keep getting "Restricted Access"
defined( '_VALID_MOS' ) or die( 'Restricted access' );
So I can never tell if it is my code or something else causing the problems.
Please Help....
~Astro
First off I am using 1.0.12 currently. I will upgrade to 1.5 when it is production stable.
Currently I need to access jos_users from the joomla database. I know a little about programming suchs as sessions, which I thought might work, I have also looked at mainframe->getUser a little however I cannot seem to get this working.
I create my php file and load it into joomla using a wrapper.
How can I get the currently logged in users name, id, or email? Anything would be good. If the user it not registerd sent directly to registration form. Initially I thought this would be easy using sessions however I guessed wrong.
Also I keep getting "Restricted Access"
defined( '_VALID_MOS' ) or die( 'Restricted access' );
So I can never tell if it is my code or something else causing the problems.
Please Help....
~Astro
Re: JOS_USERS [ Coding Help Please ]
I would guess, since your code is not part of the system (i.e. a component, module, plugin/mambot) that you are not allowed to access the necessary functions. Once the '_VALID_MOS' variable is defined, you could, theoretically, get access.AstroBoy wrote:Also I keep getting "Restricted Access"
defined( '_VALID_MOS' ) or die( 'Restricted access' );
http://springhillalumni.org • Springhill High School Alumni Association
Re: JOS_USERS [ Coding Help Please ]
Hi Thanks,
I see there is also jos_session in the database which contains username and time. Would it be possible to access sessions when a user is logged in?
I see there is also jos_session in the database which contains username and time. Would it be possible to access sessions when a user is logged in?
Re: JOS_USERS [ Coding Help Please ]
To be honest, I wouldn't know. I have not checked it out.
http://springhillalumni.org • Springhill High School Alumni Association
Re: JOS_USERS [ Coding Help Please ]
AstroBoy wrote:Hi Thanks,
I see there is also jos_session in the database which contains username and time. Would it be possible to access sessions when a user is logged in?
Instead of using the wrapper component, create a custom component. Within that component, you can do:
global $my; inside your function and access the current user data.
Ian
Help test my Component XML Generator Tool!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!
Re: JOS_USERS [ Coding Help Please ]
Thanks for the info. I guess I am stuck in the mud.
you say component?
I have a complete working php file which allows users to post jobs or resumes. However I simply need to obtain the username from joomla and my system will do the rest.
I have (index.php) includes php/html/css
I have (jobs.php) post jobs php/html/css
I have (resumes.php) post resumes php/html/css
I thought by using a wrapper and creating my layout under the min width of my website I would be able to easily implement my currently designed system into joomla.
I have to create a component, which im not familary with, do i have to recode everything??
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Why is it not possible to get the username from sessions?
Also is it not possible to use #includes or globals in my current php files to make them work with joomla, allowing me to access $my = $mainframe->getUser();
~grant
you say component?
I have a complete working php file which allows users to post jobs or resumes. However I simply need to obtain the username from joomla and my system will do the rest.
I have (index.php) includes php/html/css
I have (jobs.php) post jobs php/html/css
I have (resumes.php) post resumes php/html/css
I thought by using a wrapper and creating my layout under the min width of my website I would be able to easily implement my currently designed system into joomla.
I have to create a component, which im not familary with, do i have to recode everything??
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Why is it not possible to get the username from sessions?
Also is it not possible to use #includes or globals in my current php files to make them work with joomla, allowing me to access $my = $mainframe->getUser();
~grant
Re: JOS_USERS [ Coding Help Please ]
AstroBoy wrote:Thanks for the info. I guess I am stuck in the mud.
you say component?
I have a complete working php file which allows users to post jobs or resumes. However I simply need to obtain the username from joomla and my system will do the rest.
I have (index.php) includes php/html/css
I have (jobs.php) post jobs php/html/css
I have (resumes.php) post resumes php/html/css
My recommendation would be to create a directory under components called com_resumesystem. Inside that directory, create a file called resumesystem.php.
In that file, use a switch statement like:
$task = mosGetParam( 'task', '' );
switch( $task ) {
case 'jobs':
include( 'jobs.php' );
break;
case 'resumes':
include( 'resumes.php' );
break;
default:
include( 'index.php' );
break;
}
Then in your existing PHP files, change your links to: index.php?option=com_resumesystem&task={jobs|resumes}&...
substituing the task value as appropriate.
I thought by using a wrapper and creating my layout under the min width of my website I would be able to easily implement my currently designed system into joomla.
I have to create a component, which im not familary with, do i have to recode everything??
No, you don't have to recode everything. See above.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Why is it not possible to get the username from sessions?
I'm sure it is possible... I don't know how, so I suggested the way that I did know.
Also is it not possible to use #includes or globals in my current php files to make them work with joomla, allowing me to access $my = $mainframe->getUser();
includes perhaps, but you would basically be hand initializing the Joomla! framework and this, IMO, is a less trivial task and more prone to security problems. Basically, you can do this, but IMO it is more difficult than making your existing script into a component.
Ian
Help test my Component XML Generator Tool!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!
Re: JOS_USERS [ Coding Help Please ]
Okay cool,
I understand what you said about com_resumesystem however Im still not sure how to actually use this..
Do I continue to use a wrapper and call the link you mentioned or another method?
index.php?option=com_resumesystem&task=resumes
index.php?option=com_resumesystem&task=jobs
index.php?option=com_resumesystem < this would be default ?
I will keep playing with this however it is somewhat frustrating.
~G
I understand what you said about com_resumesystem however Im still not sure how to actually use this..
Do I continue to use a wrapper and call the link you mentioned or another method?
index.php?option=com_resumesystem&task=resumes
index.php?option=com_resumesystem&task=jobs
index.php?option=com_resumesystem < this would be default ?
I will keep playing with this however it is somewhat frustrating.
~G