vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   can't get a function or require_once code to run on hook with ajax edit (https://vborg.vbsupport.ru/showthread.php?t=279528)

BirdOPrey5 03-04-2012 07:23 PM

can't get a function or require_once code to run on hook with ajax edit
 
OK so I'm stumped... :eek:

I have code I want to run on postbit_display_complete.

If I declare the function in the plugin or put the function in an external php file and use "require_once" it runs and works fine when i load the thread.

However if I do an ajax / quick-edit to the post and re-save it the code does not run. I assume the function isn't being declared or the file isn't being included.

However if I don't use a function and just put the code directly in the postbit_display_hook then the code runs just fine after saving a quick-edit.

It's like quick-edit runs only the postbit_display_complete hook when saving but it won't get external files or declare a function.

I tried putting the require_once code on ajax_complete hook and several edit_complete hooks with no luck.

Anyone understand what I'm saying and have any ideas? :confused:

BirdOPrey5 03-04-2012 07:50 PM

The console in Chrome isn't showing any error... I'm thinking there's just some trick I'm missing...

BirdOPrey5 03-04-2012 09:29 PM

EUREKA....

Actually require_once works just fine for my needs, and had I been testing this on any other hook I probably would have been OK...

My problem was my code had an if condition to only execute if THIS_SCRIPT == 'showthread' and during an edit, even a quick edit, the script becomes 'editpost' - so once I made it work on showthread or editpost it began working as I expected.

:)


All times are GMT. The time now is 06:31 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.01032 seconds
  • Memory Usage 1,709KB
  • 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)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