Posted by Apollo610 on November 21, 2008 at 6:13pm
4 followers
Jump to:
| Project: | Advanced Forum |
| Version: | 6.x-1.0-alpha14 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
When using both ADV Forum and ADV Statistics, I received the following error:
Fatal error: Cannot use object of type stdClass as array in .../sites/all/modules/statistics_advanced/statistics_advanced.module on line 111
Turning off either ADV Statistics or ADV Forum would resolve this - however I need both for my site.
Following this thread ( http://drupal.org/node/321295#comment-1119902 ) I was able to resolve the problem by making a small change in the advanced_forum.module.
Old:
foreach (module_implements('link_alter') as $module) {
$function = $module .'_link_alter';
$function($node, $links);New:
foreach (module_implements('link_alter') as $module) {
$function = $module .'_link_alter';
$function($links, $node);I'm new to the whole Drupal community so I'm unsure how to formally submit a formal "patch", but this update seems to fix the problems I was having.
Comments
#1
Module maintainer of the Statistics Advanced module here. I've confirmed that this is the wrong way to implement hook_link_alter. The correct implementation is:
<?phpif (arg(1) != 'reply') {
$links = module_invoke_all('link', 'comment', $variables['comment']);
drupal_alter('link', $links, $node);
unset($links['comment_parent']);
}
?>
#2
Renaming title. Also see that the D6 version of hook_link_alter expects the parameters to be $links, $node, and the D5 version of hook_link_alter expects the reverse, $node then $links.
#3
I copied that code from somewhere here on d.o a very long time ago and never really looked at it that close so it wouldn't surprise me if it was wrong. :)
I'm travelling right now but will take a look at it when I get back.
Thanks,
Michelle
#4
Ok, I dug into it and what happened was that I had copied the code from the node module in D5. When I ported to D6, I didn't realize the code had changed and it didn't give me any problems. I looked at the new node_view code and it matches what you have there so I committed it.
Thanks,
Michelle
#5
Sweet! Thanks Michelle!
#6
No problem. Thanks for letting me know. I guess I don't have any modules that alter the links in the D6 version of my test site. One of the downsides of porting this module long before I'm actually using D6 myself. It doesn't get any real world testing by me.
Michelle
#7
Automatically closed -- issue fixed for two weeks with no activity.