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

dave reid’s picture

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:

    if (arg(1) != 'reply') {
      $links = module_invoke_all('link', 'comment', $variables['comment']);
      drupal_alter('link', $links, $node);
      unset($links['comment_parent']);
    }
dave reid’s picture

Title: Latest Version of Advanced Forum Clashes with Advanced Statistics » Incorrect implementation of link_alter

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.

michelle’s picture

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

michelle’s picture

Status: Active » Fixed

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

dave reid’s picture

Sweet! Thanks Michelle!

michelle’s picture

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

Status: Fixed » Closed (fixed)

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