Gix Labs

Hide Fieldgroup in custom content type

There are alot of guides that teaches you how to hide fieldgroups with hook_form_alter function. However, those only works on in-built fieldgroups, such as Author Information.

Here's a very useful function that actually hides custom fieldgroups which you have created from the Field UI:

Process older log files in AWStats

Look for your DataDir of your website and remove the particular month of the file. In our case, we are using Virtualmin that installs the AWStats and by default the DataDir of the site is stored in /var/www/awstats/[site-domain]. For example, if the site domain is, the directory that stores all the AWstats data files would be in /var/www/awstats/ You may want to backup that folder first before you start to do anything with the files. Make sure that you have the old log files that needs to be processed by AWStats.

Render a field view value in your custom module

In a theme's node.tpl.php, we can easily render a field view using Drupal's render().

For example, we have a field name field_integer with the label My integer. To display the field in the node.tpl.php, we can just call it out using render($content['field_integer']);, which will display like the following (Assuming it is the default manage display setting for the field):

My integer:
3 200

However, what if you want to render the field in your custom module? You won't be able to use render($content['field_name']).

Fix corrupted filesystem in Amazon EC2

Is your Amazon EC2 having the similar problem below?

fsck died with exit status 8
failed (code 8).
*File system check failed.
A log is being saved in /var/log/fsck/checkfs if that location is writable.
Please repair the file system manually.
*A maintenance shell will now be started.
CONTROL-D will terminate this shell and resume system boot.
Give root password for maintenance
(or type Control-D to continue):

Programmatically creating/deleting/modifying field-collection item for a node

If you have use Field-Collection module (, you would know how useful it is when you need to create a node with grouped value. However, due to how field-collection utilizes Entity API, you will not be able to programmatically update its value directly. Here's a great example on how you could do so:

Suppose 'field_page_collection1' is the field collection for the 'page' content type having two text fields 'field_page_collection1_text1', 'field_page_collection1_text2'.

MySQL Can't open file (Errno: 24)

[ERROR] /usr/sbin/mysqld: Can't open file: './database/table.frm' (errno: 24)

If you are facing this irritating problem, which not only took me hours to figure it out but also caused a little panic because it wasn't fixed although I rebooted the MySQL and the server itself - do not worry as this can be fixed very easily!