Incorrect implementation of link_alter

Dave Reid - December 6, 2008 - 01:53
Project:Forum Thread
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:jbrauer
Status:reviewed & tested by the community
Description

From #321295: Errors when other modules incorrectly implement link_alter I did a search for modules that incorrectly implement link_alter. forumthread is one of the offenders. The docs for hook_link_alter say that the function should be passed $links, then $node (a reversal from D5). Your implementation currently passes the parameters in reverse:

<?php
      $links
= module_invoke_all('link', 'comment', $comment, 1);
      foreach (
module_implements('link_alter') as $module) {
       
$function = $module .'_link_alter';
       
$function($node, $links);
      }
?>

Should be

<?php
      $links
= module_invoke_all('link', 'comment', $comment, 1);
     
drupal_alter('link', $links, $node);
?>

#1

Dave Reid - December 6, 2008 - 01:59
Status:active» needs review

Patch included for your review.

AttachmentSize
forumthread-link-alter-D6.patch 880 bytes

#2

jbrauer - December 7, 2008 - 04:25
Assigned to:Anonymous» jbrauer

Thanks Dave. I'll get that addressed!

#3

Dave Reid - December 7, 2008 - 04:39

Thanks very much JBrauer!

#4

Dave Reid - December 22, 2008 - 04:21

Any progress on this?

#5

jbrauer - December 27, 2008 - 05:44
Status:needs review» reviewed & tested by the community

Thanks Dave looks good... it's in -dev

 
 

Drupal is a registered trademark of Dries Buytaert.