Drpual
Drupal - node.tpl.php override broken
Q: Help! I have overridden node.tpl.php for my content type (like node-my_type.tpl.php) in my drupal theme but it is not working, it is having no effect at all, none of my changes are being displayed when I view nodes of that type!
A: There are a few reasons why drupal will not pick up on your new node template, the most common is just that the cache is out of date and needs to be cleared, but if your theme doesn't have a node.tpl.php file drupal won't use your overridden template either.
Drupal - Taxonomy Description in View
Q: How do I arrange for the taxonomy term description text to be displayed when I use the built in 'taxonomy_term' view to handle the display of my taxonomy lists?
A: You can get the text to display by enabling the view's header and adding in some PHP code which queries and displays the text...
Drupal - Display user picture/avatar
Q: How can I theme and display a user picture or avatar in a page, block or content template with PHP in a way that works with ImageCache and respects the default user picture?
A: One easy way to embed a user picture into your content is to create a user view to output the picture and then just embed this view into your content by calling views_embed_view() passing in the user id as an argument.
Drupal - User from Content Profile
Q: How do I get the user id that is associated with a Content Profile node, it doesn't seem to have any obvious referenced user field?
A: The user that a Content Profile node refers to is given by the node's author field! It can be accessed as $node->uid
This one had me scratching my head for a while, the answer when you think about it is kind of obvious and was staring me in the face all along...
Drupal - node.tpl.php by Node Id
Q: How can I override my theme's node template file, node.tpl.php, just for one specific node id?
A: In your theme, override phptemplate_preprocess_node() and provide a template suggestion for 'node-[nodeId]', and then flush cache.
It is easy to provide an alternative node.tpl.php template for your different content types by naming your new node template file along the lines of node-[nodeType].tpl.php, placing it in your theme folder and then clearing you cache. Drupal automatically handles all of this for you.
Drupal - 'You have already submitted...
Q: How can I remove the 'You have already submitted this form. View your previous submissions' message from my webform?
A: There is no setting to get rid of this message, however it can be quite easily removed by overriding: theme_webform_view_messages() in your theme.
Here is a handy way of removing the (sometimes) annoying webforms message - 'You have already submitted this form. View your previous submissions', see comment #11 by kees@qrios, here:
Drupal - Lightbox2 on all Links Problem
Q: Help, I just installed the lightbox2 module and now nearly every link I click on results in a lightbox appearing, what do I do?
A: Upgrade to the dev version of the lightbox2 module and the problem should go away...
Drupal - Forum Container / New Topic
Q: How do I remove or delete the forum container entries from the 'Forums:' dropdown on the 'New Topic' form? If a user chooses a forum container rather than an actual forum and then tries to create a post an error message like 'The item [Container Name] is only a container for forums. Please select one of the forums below it.' is displayed - this is really annoying the client!
Drupal - Get View results in PHP code
Q: How can I programmatically invoke a view and retrieve its result/output data in PHP?
A: Use the new(ish) views function - views_get_view_result(), and access the result data in the array that it returns.
Drupal - PHP Add Taxonomy Term
Q: How can I programmatically create or add new Taxonomy Terms using PHP code?
A: Call the function taxonomy_save_term() passing in the details of the new taxonomy term.








