vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   newpost_preview - editing message on this hook... (https://vborg.vbsupport.ru/showthread.php?t=251554)

BirdOPrey5 10-03-2010 01:47 AM

newpost_preview - editing message on this hook...
 
I have working code that makes a last minute change to displayed text in a post based on a custom profile field and it works great in postbit_display_complete. Today I realized though if a user "previews" a post before submitting it the last minute change doesn't happen because this event is a different hook.

I believe what I'm looking for is newpost_preview hook. Looking in the newpost_preview template the message is contained in $previewmessage as opposed to $postt['message'] like it is in the postbit hook.

So I changed the code I was using in postbit_display_complete to replace $post['message'] with $previewmessage but it isn't working. My code is something like:

Code:

if ($vbulletin->userinfo['field16'] == "No" OR $vbulletin->userinfo['styleid'] == 20 OR $show['guest'] OR preg_match('|domain1.com|', $previewmessage) OR preg_match('|domain2.com|', $previewmessage))
{
$previewmessage = str_replace('<my html code>', '<different html code>', $previewmessage);
}

Anyway the issue is the replacement is never made, the previewed post still looks exactly the same as if nothing changed.
:confused:

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

Update

There must have been a typo in the code, when I re-did it it worked as expected. :o


All times are GMT. The time now is 10:16 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
  • Page Generation 0.00986 seconds
  • Memory Usage 1,708KB
  • 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_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)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