![]() |
Getting the date/time of last post in a thread
Hello everyone!
I am currently working on a plugin that will automatically generate a report if a new user, that is one with less than 10 posts, posts a reply to a thread whose last post was made a significant time ago. What I have done so far is check the difference between the ids of the last post and the post that has just been submitted, using the expression: Code:
$post['postid'] - $threadinfo['lastpostid'] However, this is not completely satisfactory as it is based on forum posting activity (which could change of course) and not on time (the passage of which is constant), but I have thus far not been able to get the date/time information of the last post. For example, the expression: Code:
$threadinfo['lastposttime'] |
I think you might want $threadinfo['lastpost'].
|
Quote:
|
Where do you hook into to get the $threadinfo['lastpost'] variable? It should contain the timestamp of the last post.
|
The hook location of the plugin is "newpost_complete." I am relatively new to writing plugins, so I'm not sure if this is what you mean. :D
|
That's weird, $threadinfo['lastpost'] should have a value at that hook location.
Put the following in the hook and see what's displayed on the screen, maybe also post some more code of the plugin. Code:
print_r($threadinfo); |
Quote:
Code:
Array ( [isdeleted] => 0 [issubscribed] => 0 [emailupdate] => [folderid] => [threadread] => 1427725346 [forumread] => 1427725347 [description] => Hey everyone! [threadid] => 124 [title] => Hello again!! [prefixid] => [firstpostid] => 410 [lastpostid] => 802 [lastpost] => 1427725346 [forumid] => 10 [pollid] => 0 [open] => 1 [replycount] => 3 [postercount] => 2 [hiddencount] => 0 [deletedcount] => 0 [postusername] => regular dumb dude [postuserid] => 4 [lastposter] => MarkFL [lastposterid] => 1 [dateline] => 1420537306 [views] => 72 [iconid] => 0 [notes] => [visible] => 1 [sticky] => 0 [votenum] => 0 [votetotal] => 0 [attach] => 0 [similar] => [taglist] => [keywords] => [dbtech_thanks_disabledbuttons] => 0 [dbtech_thanks_requiredbuttons_content] => 0 [dbtech_thanks_requiredbuttons_attach] => 0 ) Okay, I just discovered I had a typo in my plugin when I attempted to use $threadinfo['lastpost'] before and it works beautifully now. My apologies for the added confusion. :o I am very grateful for the help, and once I have this plugin working correctly I will post the complete code. I have one other issue I want to iron out with this, and that is to set the reported post into the moderation queue, but I will create a separate thread for that once I have the timestamp worked out. :D |
All times are GMT. The time now is 06:12 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|