[drupal-support] Locking comment subject to the node title
Abalieno
abalieno at cesspit.net
Sat Sep 10 23:46:22 UTC 2005
It works :)
After many attempts to get it right this is the code I used:
// subject field:
if (variable_get('comment_subject_field', 1)) {
$node = node_load(array('nid' => $edit['nid']));
$form .= form_textfield(t('Subject'), 'subject', $edit['subject'] ?
$edit['subject'] : t('Re: '). $node->title, 60, 64);
}
It works correctly, the syntax is okay too?
----- Original Message -----
From: "Bèr Kessels" <berdrupal at tiscali.be>
To: <drupal-support at drupal.org>
Sent: Saturday, September 10, 2005 2:47 PM
Subject: Re: [drupal-support] Locking comment subject to the node title
Op zaterdag 10 september 2005 13:18, schreef Abalieno:
> $form .= form_textfield(t('Subject'), 'subject', $edit['subject'] ?
> $edit['subject'] : 'Re: '. $node->title, 60, 64);
This should be
$form .= form_textfield(t('Subject'), 'subject', $edit['subject'] ?
$edit['subject'] : t('Re: '). $node->title, 60, 64);
And AFAIK there is a 'nid' ni the comment oject
A node_load() with that nid will give you the parent node object.
More information about the drupal-support
mailing list