Closed (duplicate)
Project:
Quote
Version:
master
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Dec 2006 at 12:11 UTC
Updated:
3 Dec 2007 at 18:16 UTC
When using the quote module in Drupal 5 (rc1), you get an fatal error, since the hook_link hooks now return structured links/arrays (as i found out <:), and old 4.7 quote module returns strings.
To make the quote-Module work under Drupal 5 replace the following old function with the new one below:
OLD 4.7:
function quote_link($type, $post = 0, $main = 0) {
$links = array();
if (user_access('post comments')) {
// $post can be either a node or a comment.
if ($type == 'comment') {
// Display quote link for comments only if the parent node is accepting comments and has the quote filter enabled.
$node = node_load(arg(1));
if (in_array($node->type, variable_get('quote_node_types', array('blog', 'story'))) && $node->comment == COMMENT_NODE_READ_WRITE) {
$links[] = l(t('quote'), "comment/reply/$post->nid/$post->cid/", array('title' => t('Quote this comment in your reply.')), 'quote=1');
}
}
elseif ($type == 'node' && in_array($post->type, variable_get('quote_node_types', array('blog', 'story'))) && $post->comment == COMMENT_NODE_READ_WRITE && variable_get('quote_node_link_display', 1)) {
// Display quote link for nodes only if the node is accepting comments, has the quote filter enabled and has quote_link_display set.
$links[] = l(t('quote'), "comment/reply/$post->nid/", array('title' => t('Quote this post in your reply.')), 'quote=1');
}
}
return $links;
}
New 5.0 compatible:
function quote_link($type, $post = 0, $main = 0) {
$links = array();
if (user_access('post comments')) {
// $post can be either a node or a comment.
if ($type == 'comment') {
// Display quote link for comments only if the parent node is accepting comments and has the quote filter enabled.
$node = node_load(arg(1));
if (in_array($node->type, variable_get('quote_node_types', array('blog', 'story'))) && $node->comment == COMMENT_NODE_READ_WRITE) {
$links['quote_quote'] = array(
'title' => t('quote'),
'href' => "comment/reply/$post->nid/$post->cid/",
'attributes' => array('title' => t('Quote this comment in your reply.')),
//'quote=1'
);
}
}
elseif ($type == 'node' && in_array($post->type, variable_get('quote_node_types', array('blog', 'story'))) && $post->comment == COMMENT_NODE_READ_WRITE && variable_get('quote_node_link_display', 1)) {
// Display quote link for nodes only if the node is accepting comments, has the quote filter enabled and has quote_link_display set.
$links['quote_quote'] = array(
'title' => t('quote'),
'href' => "comment/reply/$post->nid/",
'attributes' => array('title' => t('Quote this post in your reply.')),
//'quote=1'
);
}
}
return $links;
}
Comments
Comment #1
danielnolde commentedOh, i just saw that i ommited the "quote=1" parameter (i just commentet it out) - does anyone know how to pass it under Drupal 5?
Comment #2
Zen commentedThe module works fine under D5. Marking as a general dupe.
Thanks.
-K