It'd be great to extend the functionality of this module to comments (which I'm starting to do) and as a first step to that the use of 'node' has to be abstracted. The attached patch alters most of the functions to refer to a generic object and to check what is set as updown_type, an attribute added to the node object in updown_nodeapi().

Updown behaves exactly the same as before with patch applied.

Comments

coltrane’s picture

Status: Needs review » Needs work

$comment->nid is set, so my isset() check is incorrect. Will reroll soon.

coltrane’s picture

Status: Needs work » Needs review
StatusFileSize
new5.18 KB
dmitrig01’s picture

Version: » 6.x-1.x-dev

You're taking the limit off of just nodes and moving it to just comments. What about making it work for anything, like users, taxonomy terms, or fish?
The offending lines are:

+    'content_type' => $object->updown_type == 'node' ? 'node' : 'comment',
+    'content_id' => $object->updown_type == 'node' ? $object->nid : $object->cid,

What about adding an $object->updown_id and doing this?

+    'content_type' => $object->updown_type,
+    'content_id' => $object->updown_id,
dmitrig01’s picture

Status: Needs review » Fixed

It'll be in the next version - thanks!

Status: Fixed » Closed (fixed)

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