PDA

View Full Version : Quick reply hook


virtus
03-08-2011, 06:04 PM
I am trying to make a "post a day" limit for a specific forum. here is the code.


if($threadinfo["forumid"] == 51){

if(mktime(date("G"),date("i"),date("s"),date("n"),date("j"),date("Y")) < ($threadinfo["lastpost"] + 86400)){
header('Location: http://www.example.com/');
}
}


Obviously I will change the end result to an error.

It works exactly how I want ti to and I have this set under the newreply_start hook. However, this does not work for the quick reply, which I am assuming uses ajax, but have not been able to find a hook that triggers for it.

So, how can I have this code trigger when someone tries to just do a quick reply?

Are there any other options?

Thanks

Thunderbird8
03-09-2011, 06:24 AM
I made a plugin to block double-posting if the previous post is less than a day old, and attached the plugin to the newreply_post_start hook (which allows people to enter the Post Reply screen, but not actually post it). Similar purpose, and as far as I can tell, it works for Quick Reply too (since that hook is called when the post is being entered).

Try using newreply_post_start instead and see what happens.

virtus
03-09-2011, 02:55 PM
I'm trying to hunt down the way to create a custom error at the moment.

However, using the example I have above with the newreply_post_start hook it does not work at all, for either advanced mode or quick reply.

could you show me how you created your error message, I'm digging around for a link and looking through code to no avail.

--------------- Added 1299692058 at 1299692058 ---------------

update: almost got this working now :D just fighting with "cannot find phrase" error on a custom phrase for the error

--------------- Added 1299693536 at 1299693536 ---------------

got it working! :D

Thanks thunder, it was actually failing because I was testing using a header.