Blog

How to remove the "My account" link

Categories:

This php snippet is useful for customizing the behavior of the "My account" link. Sometimes you want to place a login link in one of the menus. It might be confusing sometimes because after you login, the link won't show as "Logout" but as "My account". This is not ideal so you can use the snippet to make it show as "Logout".

Place this code inside your template.php file.

register_globals is enabled

Categories:

Sometimes on some hosts you will get an error or warning after installing Drupal that says "register_globals is enabled". You can correct this by creating a php.ini file in your drupal root directory and then inserting the following line of code:

register_globals = Off

you can see the complete drupal post here: http://drupal.org/node/216882

Error 500 - Internal server error (1and1 hosting)

Categories:

Copy and paste the following line into your .htaccess file:

AddType x-mapp-php5 .php

go to http://drupal.org/node/232773 for the complete drupal forum post.

Webform form insert

Categories:

Php snippet to insert a webform in any node.

.htaccess drupal redirection

Categories:

.htaccess code snippet to have any url to redirect to another url. You would insert this in your .htaccess file. This is very useful when you are migrating a static html site into a Drupal site.

Generate a CSV file

Categories:

Snippet to generate a CSV file from any table or combination of tables from the data base.

Access content denied for anonymous user

Categories:

I have come across this issue many times now. It started to appear in Drupal 5.x . The reason is not completely clear to me but some say that it has something to do with the tac_lite module. It seems that when you enable this module and then you disable it, it won't properly restore the node_access table in the database. It won't create the default node_access row. To fix it, just run the following query:

Define new regions in your theme

Categories:

This snippet contains the default regions in the bluemarine theme. I just copy and paste it in the template.php and start adding new ones to the array. And then I define them inside my page.tpl.php

This is very useful if you want to place blocks in custom places and easily manage them from the blocks page.

Avoid duplicating posts

Categories:

This code is very useful to avoid duplicated posts in your Drupal site. Some times when users try to submit a form, the form will take more than usual to reload or to respond. In those cases you want to have the submit button to disappear and to show a message saying that the form is being processed. I found this piece of code somewhere in the durpal.org site. I have been using it all the time and works like a charm.

This is a jQuery snippet and goes inside a block or page or node.

Complex union query

Categories:

Simple sample of a long mysql query I did for a module.

Syndicate content