Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Adding comment ID to comment meta class
hbf
MVP
i'd like a plugin that adds the comment id number to the comment meta class. if anyone has already done this i'd like to avoid re-inventing the wheel, otherwise any help getting started writing my own would be appreciated.
0
Best Answer
-
Todd Vanilla Staff
I think you want to start with
$Count = $Sender->CurrentOffset
and then just increment it as you go through the comments.0
Answers
ok so i got a little ways but now am totally stuck. I used this code (hack of the quotes plugin) to display the comment ID on the comment. problem is, that number has nothing to do with the number of comments in the thread, it's the database entry id. so the 2nd comment on a thread started today on my forum could be comment # 28000. when im looking for 2. so can i modify the database queries (simply) to get the right number?
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
so, i think i need the item number for the discussion instead of comment ID, but im sure thats a calculated value.
can anyone tell me how to extract that for each comment?
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
I think you want to start with
$Count = $Sender->CurrentOffset
and then just increment it as you go through the comments.i quick test did not yield what i was hoping for
displays Post of 26453
so the current offset isnt on the sender object for either of the two hooks im using
thanks in advance for your help!
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
$Count = $Sender->CurrentOffset;
should be $Count = $Sender->Offset;
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
while the controller offset wasn't the final answer, it led me to find the simplest cleanest solution.
$Offset = !isset($Sender->EventArguments['Comment']) ? 1 : $Sender->CommentModel->GetOffset($Sender->EventArguments['Comment']) + 2;
there it is. one line of simple perfection.
If i can figure out how to do it, i will post my new, ultra snazzy plugin for all to benefit from. (and bask in its glorious simplicity)
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
My first official plug-in:
http://vanillaforums.org/addon/postnum-plugin-.1
Feel free to code review and let me know if I did something stupid.
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained