Pedro Posada
  • How to remove the "My account" link
    Posted on May 15, 2008 - 4:22pm

    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
    Posted on May 12, 2008 - 2:30pm
    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)
    Posted on May 12, 2008 - 2:18pm

    Copy and paste the following line at the beginning of your .htaccess file:

    ##
    AddType x-mapp-php5 .php
    AddHandler x-mapp-php5 .php
    ##

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

    ADDITIONAL IMPORTANT INFORMATION

  • Webform form insert
    Posted on April 24, 2008 - 4:40pm
    Php snippet to insert a webform in any node.
  • .htaccess drupal redirection
    Posted on April 22, 2008 - 12:02pm
    .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
    Posted on April 17, 2008 - 12:14am
    Snippet to generate a CSV (comma separated values) file from any table or combination of tables from the data base.
  • Access content denied for anonymous user
    Posted on April 16, 2008 - 11:40am
    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
    Posted on April 10, 2008 - 10:32am
    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
    Posted on April 9, 2008 - 4:51pm
    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
    Posted on April 3, 2008 - 3:12pm
    Simple sample of a long mysql query I did for a module.