vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Quick reply hook (https://vborg.vbsupport.ru/showthread.php?t=260053)

virtus 03-08-2011 06:04 PM

Quick reply hook
 
I am trying to make a "post a day" limit for a specific forum. here is the code.

PHP 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 [DATE]1299692058[/DATE] at [TIME]1299692058[/TIME] ---------------

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

--------------- Added [DATE]1299693536[/DATE] at [TIME]1299693536[/TIME] ---------------

got it working! :D

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


All times are GMT. The time now is 05:26 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01037 seconds
  • Memory Usage 1,716KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete