Got a question?  Ask a developer in our Developer's Corner Forum

Back To The Developer's Corner Main Page

Useful Basic Joomla PHP Functionality

A few of the questions I've answered on the Joomla forums are how to do some pretty basic PHP tasks.  I think just seeing a few of the examples will help developers understand how useful the API documentation is and help them understand where to get further help, so I'm going to try to start cataloging them here.  If you have a suggestion for things to add, let us know.

 

How Can I Tell What Type of User Is Logged In?

There are a few different functions to help with this:
http://api.joomla.org/Joomla-Framework/User/JUser.html#$usertype
$user = &JFactory::getUser();
if($user->usertype == "Super Administrator" || $user->usertype == "Administrator")

http://api.joomla.org/Joomla-Framework/User/JUser.html#$gid
$user = &JFactory::getUser();
if($user->gid == 25 || $user->gid == 24)

 

http://api.joomla.org/Joomla-Framework/User/JUser.html#$guest

$user = &JFactory::getUser();
if($user->guest)

 

 

 

Part of the SourceCoast Network:

SourceCoast / Cooking Allergy Free / CMS Market

© 2010 CMS Market. All rights reserved.

Joomla Facebook integration by JFBConnect

GTranslate Joomla Module