"Terms" node must contain Body field.

alanburke - January 5, 2009 - 11:02
Project:Terms of Use
Version:6.x-1.8
Component:Code
Category:feature request
Priority:normal
Assigned:Chill35
Status:postponed
Description

Hi Caroline,

My 'terms of use' node contains only CCK fields, with no body field.

It appears as blank on the user registration process, as it has no $body field.

As well as that, if a node has a body field and some additional CCK fields, only the body field will appear on the form.

Regards
Alan

#1

alanburke - January 5, 2009 - 11:05
Status:active» needs review

Patch for consideration.
Main change is using node_view rather than node_prepare.

[Warning! Novice developer & patcher at work]

Regards
Alan

AttachmentSize
354488-terms_of_use.patch 892 bytes

#2

Chill35 - March 23, 2009 - 18:18
Category:bug report» feature request
Assigned to:Anonymous» Chill35
Status:needs review» postponed

I have applied the changes in my sandbox as per your recommendation.

If I had to do it all over again, I would use node_view() instead of node_prepare().

However... If I make the changes now, it will 'break' all sites that use this module, as extra content will be injected in the Terms of Use fieldset, including the node title.

You probably should not use CCK for this. Terms of Use are better stored in a 'page' and it's good practice to add a link to this page in your Footer Menu. Please use the 'page' content type for this.

#3

hefox - September 11, 2009 - 15:04

Same issue

I am using page, however I don't use a body field for page and instead use CCK fields. (And several other developers I know also do this; it's so much more configurable and enjoyable to use compared to core body).

<?php
function node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE) {
?>

http://api.drupal.org/api/function/node_view/6

So more correctly it should be

$terms = node_view($node, FALSE, TRUE,FALSE);

To prevent the title and links from showing

node_prepare is not needed for node_view, as it already calls it.

Here's a slightly modified verision of the patch

AttachmentSize
terms_of_use_nodeview.patch 558 bytes
 
 

Drupal is a registered trademark of Dries Buytaert.