08 November 2010
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.";
30 September 2010
MySQL (4th Edition)Suppose we have a table called USERS that has a primary key 'id' and another table SUBSCRIPTIONS with foreign key 'uid'.

If we want to remove all subscriptions (from the SUBSCRIPTIONS table) that does not correspond to any user, we can run this MySQL query:

What we are doing here is getting a list of all the ids from the USERS table and then deleting all rows from the SUBSCRIPTIONS table where the user id (uid) does not correspond to any id in the USERS table. Very simple.

Note: Throughout this blog, you will find many books that are for sale on Amazon. I recommend you get these books while learning web programming as they will help strengthening your skills.
20 August 2010
The key is to doing this is to traverse the DOM and then call the DOM's deleteChild() method.

We can identify the file to be deleted by using its filename or CSS class name. Here I am going to use its filename.

function deletejscssfile(filename, filetype){

var targetelement=(filetype=="js")? "script" : (filetype=="css")? "link" : "none" //determine element type to create nodelist from

var targetattr=(filetype=="js")? "src" : (filetype=="css")? "href" : "none" //determine corresponding attribute to test for

var allsuspects=document.getElementsByTagName(targetelement)

for (var i=allsuspects.length; i>=0; i--){ //search backwards within nodelist for matching elements to delete

if (allsuspects[i] && allsuspects[i].getAttribute(targetattr)!=null && allsuspects[i].getAttribute(targetattr).indexOf(filename)!=-1)

allsuspects[i].parentNode.deleteChild(allsuspects[i]) //delete element by calling parentNode.deleteChild()



deletejscssfile("script_to_be_removed.js", "js") //delete all occurences of “script_to_be_removed.js” on page

deletejscssfile("script_to_be_removed.css", "css") //delete all occurences of “script_to_be_removed.css” on page
17 August 2010
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

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

Joomla! BibleJoomla! Bible

Learning Joomla! 1.5 Extension DevelopmentLearning Joomla! 1.5 Extension Development
22 April 2010
The following code might be useful to you if you want to get the current language in your custom component/module/plugin.

It will get the current language that is active on the website:

$lang =& JFactory::getLanguage();
echo "The current language is:". $lang->getName();

Reference : JFactory/getLanguage - Joomla! Documentation

If you are learning to develop your own Joomla component, module or plugin, the following book is a must have.

You can get it for cheap on Amazon.
11 April 2010
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

Display on registration page

For updating info

Backend user form
Joomla! Bible

How do you find this blog

Powered by Blogger.


Current readers

Affiliate products