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.
- Add new comment
- Read more
- 10 reads
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 = Offyou can see the complete drupal post here: http://drupal.org/node/216882
- Add new comment
- 18 reads
Error 500 - Internal server error (1and1 hosting)
Categories:Copy and paste the following line into your .htaccess file:
AddType x-mapp-php5 .phpgo to http://drupal.org/node/232773 for the complete drupal forum post.
- Add new comment
- 20 reads
Webform form insert
Categories:Php snippet to insert a webform in any node.
- Add new comment
- Read more
- 76 reads
.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.
- Add new comment
- Read more
- 74 reads
Generate a CSV file
Categories:Snippet to generate a CSV file from any table or combination of tables from the data base.
- Add new comment
- Read more
- 76 reads
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:
- Add new comment
- Read more
- 62 reads
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.
- Add new comment
- Read more
- 86 reads
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.
- Add new comment
- Read more
- 75 reads
Complex union query
Categories:Simple sample of a long mysql query I did for a module.
- Add new comment
- Read more
- 140 reads