Authorship Module does not apply to Comments
juansa - June 14, 2006 - 23:45
| Project: | Authorship Module |
| Version: | 5.x-1.1 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | AjK |
| Status: | closed |
Description
Hi there,
I just installed Authorship and hey, it's great, it should even be considered to make it part of the main drupal installation.
I wonder if there's any chance to make Authorship work on Comments as well as Nodes. I don't know, maybe it's not that easy to make such modification, but I think it would make a great improvement.

#1
Good point actually. I've just had a look over the API and it appears the "comments" module is less flexible than the "node" module. There's awful lot you can do with nodes but seems alot less you can do with comments.
I'm sure it's possible just I can't see it at a quick look.
I will look in more detail when I get time but if someone else reads this and can point me in the right direction then let me know please.
best regards
--AjK
#2
yeah just wanted to add a quick note to say yes it's a great module but unfortunately won't be any use unless it can be applied to comments also
#3
The API for "comments" doesn't extend the scope of modifying them in the same way that "nodes" do. So I'm afraid this isn't possible to do as a module but would need changes to comments.module which is a core module. That means a patch against core rather than a "free standing plugin" module.
So, I don't see this happening as I'm not going to create a core patch that needs maintenence each time comments.module is updated.
If I had the time I'd make a patch for comments.module that added enough API to do what's needed by modules and try and get that patch into core. But right now, I'm rather too busy on other projects to give it the attention it warrents.
best regards
--AjK
#4
#5
This seems like an issue with core that should be raised to development team. I agree that it would be much more friendly if it worked with comments as well.
#6
Drupal 5 comment.module offers hooks for implementing the authorship functionality in comments. The attached patches will do the trick.
Patch both authorship.module and authorship.install and run the update script (!). Select update 2 for the Authorship module.
For fresh installations simply enable the patched module.
List of changes:
1. authorship.module:
a) authorship_form_alter(): authorship controls in the comment-form
b) authorship_form_alter(): authorship controls in the comment-admin-settings
c) authorship_comment(): implementation of hook_comment()
d) authorship_nodeapi(): INSERT is performed only when at least one of {$node->authorship, $node->profile_real_name} is specified. No point of storing empty rows.
2. authorship.install:
a) authorship_install(): updated DB structure
b) authorship_update_2(): to update previous installations of the Authorship module
c) authorship_uninstall(): implementation of hook_uninstall()
#7
...and the 2nd patch (see above)
(I was unable to attach both files to a single post)
#8
@lafo : I have added you to the CVS access for this module :)
#9
Thanks, I committed the updated files to the CVS.
#10
Hi, and thanks for the effort. Just a couple of things.
When you committed your patch your commit message was pretty verbose. Really, all you need do for a commit message is "#69091 by myself". The Drupal system picks up the #69091 as a d.o node number and links to it (this issue) and you can attribute the patch to, er, yourself! (as it's your work).
Also, after committing to CVS to fix an issue, don't forget to change the issue status to "fixed".
Also, I think your work was on the DRUPAL 5 branch (as it has better comment support). In that case you should also update the "Version" of this issue to reflect what branch you are "fixing". If you are happy with your work don't forget to add a CVS tag and do a release.
Thanks for your time on this module. I will leave CVS access enabled for you so you can continue to co-maintain it when ever you feel like it.
regards,
--Andy
#11