Any plans to port this totally underrated and awesome module to D7?

Comments

siliconmind’s picture

Status: Active » Postponed

Unfortunately not, as I currently don't run any D7 site.
But I can help if anyone is willing to do the port.

berdir’s picture

StatusFileSize
new7.95 KB

Needed something like this for a client project, so here is a patch.

While the result is the same, the implementation differs quite a bit. There two major differences:

1. cid's are stored directly in $_SESSION instead of a db table. This has a number of advantages:
- Just like the table, when the session expires or you get a new one, this stops working. However, in this case, the session data is removed and nothing remains of it in the database.
- Drupal 7 automatically keeps session data when a user logs in, removing the need for the hook_user() implementation.
- No additional queries are necessary, Drupal 7 automatically creates a session if something is stored in $_SESSION.

There is one disadvantage though and that is that the information in $_SESSION can not be removed when the comment is published/deleted. I however doubt that a single anon user is going to write so many comments that this could result in a problem before his session drops. And for registered users, we could actually stop using $_SESSION completely and simply rely on the user id?

2. Thanks to the new database API, this module can now directly inject the query that fetches the comments from the database. This means that all it needs to do is change the query and implement hook_comment_view_alter() to remove the reply link and print a message.

These changes combined with the usual D6/7 API changes result in a pretty much complete rewrite of the code.

Please test.

berdir’s picture

Category: feature » task
Status: Postponed » Needs review
siliconmind’s picture

Berdir, could you please provide a full patched source? I won't have access to appropriate tools for some time, but if module works then others could use it already.

Or maybe you would like to become co-maintainer?

pdpravindeshmukh’s picture

Status: Needs review » Closed (fixed)

Hi Berdir,

Thanks for the D7 patch.It works gr8 for me. :)

berdir’s picture

Status: Closed (fixed) » Needs review
ezheidtmann’s picture

StatusFileSize
new8.52 KB

I've tested Berdir's patch and made some adjustments. I put code adding a condition into the innermost "if" statement (otherwise it would conflict with another comment filter module I have) and converted to UNIX line endings.

Needs review & testing

ezheidtmann’s picture

StatusFileSize
new8.56 KB

Fixed PHP notice in previous when other users view page.

walker2238’s picture

I tried this port out and all worked as expected with the exception of posting a comment when no other comments were posted for a particular node the comment doesn't show.

Did anyone else experience this?

ezheidtmann’s picture

StatusFileSize
new9.23 KB

I didn't see that cause I didn't test it! Thanks for finding that bug!

Try this and let me know how it works.

walker2238’s picture

I gave it a quick run though and seems good with one exception.

in su_comments_node_view there isn't any check for node teaser so the comment will appear in the teaser view of a node. But that's the only issue I noticed this time around.

ezheidtmann’s picture

StatusFileSize
new9.49 KB

Thanks for the additional review, walker2238. This patch adds to su_comments_node_view() the same check that is used in comment_node_view().

walker2238’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

ezheidtmann’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Reviewed & tested by the community » Closed (fixed)

7.x version is available on project page. Testers and feedback welcome!