Showing posts with label Joomla. Show all posts
Showing posts with label Joomla. Show all posts

08 November 2010

Check the group id of a user in Joomla

If you are doing your own custom Joomla component, somtimes it is very helpful to determine the user group of a user in order to perform necessary actions (for example, only admins can delete a record).

For doing this, we must get the group id. They are as follows:

Public : 0
Registered : 1
Special : 2

Users that have access to the backend fall under the Special group.

The following code will check the group id of the current user and display a message if user is not of 'Special' type.
$user = JFactory::getUser();
$userGID = $user->get('gid');
if ($userGID != 2)
{
   echo "You do not have the necessary permissions to perform this action.";
}

17 August 2010

Recommended Joomla books

I have come across these books during my career as a programmer and I can say, they are worth every penny. I highly recommend you buy them if you are into Joomla development.


Joomla! Start to Finish: How to Plan, Execute, and Maintain Your Web Site (Wrox Programmer to Programmer)Joomla! Start to Finish: How to Plan, Execute, and Maintain Your Web Site
$38.54











Joomla! 1.5: A User's Guide: Building a Successful Joomla! Powered Website (2nd Edition)Joomla! 1.5: A User's Guide: Building a Successful Joomla! Powered website
$29.69










Joomla! BibleJoomla! Bible
$29.69








Learning Joomla! 1.5 Extension DevelopmentLearning Joomla! 1.5 Extension Development
$34.08

11 April 2010

Adding additional Joomla registration fields

The default Joomla registration page is very basic. In many situations, one might want to add field to it. This is how to do it:

Just add the fields you want to the following files:

For saving the info
libraries/joomla/database/table/user.php

Display on registration page
components/com_user/views/register/tmpl/default.php 

For updating info
components/com_user/views/user/tmpl/form.php

Backend user form
administrator/components/com_users/views/user/tmpl/form.php
Joomla! Bible