PCinvent.info

PCinvent Studio Template

Jun 17 2008
Joomla 1.0 Determine User Login & User Name Print E-mail
Tuesday, 17 June 2008


Read More Articles in: Technology>>>Programming

This Article is written by This e-mail address is being protected from spam bots, you need JavaScript enabled to view it


To determine user login already or not in Joomla page, here is the code that you can use.
You might also need a custom code plugin in order to insert the code into the joomla page. Search the Joomla Extension page for "Jumi" of which I recommend......

 

<?php
/*
 * author andy <http://www.pcinvent.info>
    Please keep the above credit line to the Author
**/
defined( '_VALID_MOS' ) or die( 'Restricted access' ); // For security reasons do NOT REMOVE this line!
?>
<?php
//andy:determine user login or not and decide to redirect action
global  $mainframe;
$userInfo = $mainframe->getUser();
                        if($userInfo->id == 0)
            {
            header ( "location: index.php?option=com_content&task=view&id=3&Itemid=80");//Redirect  user who hasn't login yet
           }
            else
            {
             echo $userInfo->username //Output who login
            }
?>

defined( '_VALID_MOS' ) or die( 'Restricted access' ); is a security check that should be included in every joomla php file.

 

Comments (0)Add Comment

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley

busy
Tags:  Technology Programming Joomla 1.0 Determine User Login & User Name Joomla Framework Joomla Show user
 
< Prev   Next >
Site by PCinvent.com