Web design, programming, graphics, and pretty much anything else I care about.

d6

Retrieving custom field formats in Drupal template files

This is part of CCK:

<?php
content_format
('field_cckfieldname', $node->field_cckfieldname[0], 'machine_name_of_custom_format')
?>

You send it the name of the field you are referencing, the data, and the name of the format you want. If you don't include the format, it uses the default for that field. It returns fully-formatted HTML. Example,

<span class="date-display-single">Friday, October 16, 2009, at 8:00 pm</span>

Node reference URL widget not checking user access?

I seem to have a bug in the Node reference URL widget module (http://drupal.org/project/nodereference_url). It is not checking to see if the user has the correct permissions to create a node of the type being referenced. The link to create a node should not appear if they do not have access.

On this line

<?php
if ($field['referenceable_types'][$object->type] && user_access('create ' . $object->type . ' content')) {
?>

I replaced $object->type with $target_type and it seems to work fine.

<?php