[thelist] Converting php forms/session to Joomla - solved

Bob Meetin bobm at dottedi.biz
Wed Oct 24 14:43:49 CDT 2007

> I'm converting a site for which I designed an administration section 
> with login/password and PHP sessions to Joomla. 
> Can I get some suggestions as to what I would need to do, add to my 
> forms, session-wise, so that they will run with Jooma or what code I 
> need to be grabbing from Joomla to make this happen?  
I don't know if this is a sanctioned solution, but it seems to work for 
what I need.  This is not returning the session info, but if a 
registered member, author type or admin are logged in it is returning 
the information I need. to set privileges on a bunch of forms I want to 
include on the site.

In the joomla install, find the file: 
Around line 46 is a line that begins with: 
    if ( $my-> id ) {
Above the line I added a global variable: 
    global $my_usertype;
In the if statement under the
    if ( $greeting ) {
line  I added: 
    $my_usertype = $my->usertype;

It looks like:

global $my_username;
global $my_id;
global $my_usertype;

if ( $my->id ) {
// Logout output
// ie HTML when already logged in and trying to logout
    if ( $name ) {
        $name = $my->name;
    } else {
        $name = $my->username;
    <form action="<?php echo sefRelToAbs( 'index.php?option=logout' ); 
?>" method="post" name="logout">   
    if ( $greeting ) {
        echo _HI;
        echo $name;
        $my_usertype = $my->usertype;
        $my_id = $my->id;
        $my_username = $my->username;

---->>>> and some more html stuff follows.

Then in the index.php file in the $HOME folder I added an output test 
(at the end of the page):

echo "my_usertype: $my_usertype<br>";

To test I set up a couple different user types through the joomla 
administrator page and then login/out as these users.  It nicely 
displays the user type (Registered, Author, Super Administrator) which I 
need and if I want can easily display their name, username, etc.


More information about the thelist mailing list