Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
ajax_comments_preprocess_comment() calls a module_invoke_all('link') which causes all modules which have hooked into hook_link_alter to modify $links to lose their modifications.
You were calling this i believe because your ajax_comments_link_alter() was not working properly. The reason it is not working properly is that the call to drupal_alter('link') in ajax_comments_submit() neglects the inclusion of the $comment object which your link_alter checks for before rewriting the 'delete' link.
Attached is a patch that fixes both of these issues.
Comment | File | Size | Author |
---|---|---|---|
#2 | ajax_comments_fix-1042786.patch | 1.33 KB | gregstout |
ajax_comments-fix_broken_hook_link_alter_and_double_hook_link_call.patch | 1.39 KB | nibblebot | |
Comments
Comment #1
nibblebot CreditAttribution: nibblebot commentedThis bug also afflicts comment_bonus_api. I've created an issue for that here: #1042794: incomplete call to drupal_alter('link')
Comment #2
gregstout CreditAttribution: gregstout commentedI ran into the same problem and used the above code to fix it. Confirmed that it doesn't recalculate the $links again and all my hook_link_alter functions for the $links will not be overwritten.
It seems maybe the patch above is malformed, but here is the patch I created from the code I changed (which it exactly as the above patch).
Comment #3
qzmenkoIssue is closed because 6.x version is unsupported. Feel free to open new issue for 7.x or 8.x versions of module.