Drupal - CCK email field from PHP

Q: How do I access a node's CKK email field from PHP, I tried $node->my_email_field[0]['value'] and it didn't work?!
Q: A lot of fields can be accessed via ['value'] but not the CCK emailfield, instead use:

  $node->my_email_field[0]['email']

I keep forgetting this and have to switch on devel module and use dvm() to check the field makeup which is a pain - so I am writing it down now!

Drupal, Remove 'Submitted by' Text

Q: How can I remove the 'Submitted by' text that is always displayed with my CCK type?
A: Go into the Administer, Themes screen, click on the 'Configure' tab (/admin/build/themes/settings) and then un-check the 'Display post information on' checkbox for your Node type.

This post once again deals with how to re-configure some of drupal's default behaviour so that your website more closely matches your target web design.

Drupal - Display Fivestar on CCK Node with content template

Q: How do I get the fivestar widget to display on CCK nodes when using a content template to format the CCK type, I have enabled it for my type but the fivestars widget does not show up at all?
A: If you're using a content template to display your CCK node you have to explicitly add code to display the fivestar widget by outputting the contents of: $node->content['fivestar_widget']['#value'];

Drupal - Remove 'Revision Information'

Q: How can I get rid of that pesky but persistent 'Revision Information' settings section from the create & edit content forms in Drupal 6?

A: You just need to hook into the phptemplate_node_form() function and disable the field - just a bit of PHP required!

Drupal 6 - Specify URL for CCK Type

Q: How can I arrange for the content type that I created with the CCK to follow a specific path/URL pattern?
A: Specify the Path template in the following settings section - Administer/URL aliases/Automated alias settings/Node path settings

Pride on FacebookPride on TwitterPride on TwitterPride on Twitter

Join Our Newsletter

* indicates required

Irish Internet Association

finalist.png
phone-number.png