The hook_link() should have the following parameter names:
hook_link($type, $object, $teaser = FALSE)
See http://api.drupal.org/api/function/hook_link/6

Here's a patch that fixes the parameter $object and all its instances:

CommentFileSizeAuthor
#3 vote_up_down.hook_link_1.patch1.86 KBAnonymous (not verified)
#2 vote_up_down.hook_link_0.patch3.24 KBAnonymous (not verified)
vote_up_down.hook_link.patch3.28 KBAnonymous (not verified)

Comments

lyricnz’s picture

Status: Active » Needs work

In the body of the method, in "case 'node'" this patch changes $node_type to $object_type - this is incorrect. It should stay $node_type (since we know this is a node by then).

Perhaps a cleaner way to do this, is to do something like:

function vote_up_down_link($type, $object, $teaser = FALSE) {
  switch ($type) {
    case 'node':
      $node = $object; // alias for clarity
      $node_type = in_array($node->type, variable_get('vote_up_down_node_types', array()), TRUE);
      ...
    case 'comment':
      $comment = $object; // alias for clarity
      ...
      $comment->cid

Or even:

function vote_up_down_link($type, $object, $teaser = FALSE) {
  $$type = $object; // type-specific alias for clarity
  ...
Anonymous’s picture

StatusFileSize
new3.24 KB

Heres the updated patch.

Anonymous’s picture

StatusFileSize
new1.86 KB

NOTE: The last patch was confusing.

lyricnz’s picture

Status: Needs work » Reviewed & tested by the community

Yes, I like this patch now - nice and simple.

lut4rp’s picture

Status: Reviewed & tested by the community » Fixed

Fixed. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.