vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   change post upon save (https://vborg.vbsupport.ru/showthread.php?t=266272)

yjeanrenaud 07-04-2011 07:40 PM

change post upon save
 
Hi,

i would like to change something in messages posted.
therefore I would have written a plugin on postdats_presave hook
PHP Code:

$checkcontent $vbulletin->GPC['message'];
   if (
strpos($checkcontent"foo"))
   {  
    
$newcontent=str_replace("foo""bar",$checkcontent);
    
$vbulletin->GPC['message'] = $newcontent;
   } 

is this how the plugin systems work?

BirdOPrey5 07-04-2011 08:32 PM

Assuming $vbulletin->GPC['message'] actually contains the message before it's saved then yes that is how the plugin system would work.

yjeanrenaud 07-05-2011 04:28 AM

thanks :)
doesn't seem to work. so, how may I find out where the message is stored at the moment of this hook?
I saw other plugins https://vborg.vbsupport.ru/showthread.php?t=150761 using this, but maybe because I'm on 4.1.4 and not 3.1.6 it fails?

BirdOPrey5 07-05-2011 11:09 AM

I will move this to the VB 4.x forum for you then. I would try $post['message'] or $newpost['message'] and see if either of those work.

The right way would be to open the php file and see what variable is actually be used around that hook. But guessing doesn't really hurt anything.

BirdOPrey5 07-26-2011 11:44 AM

FYI the appropriate variable for this was: $this->post['pagetext']

yjeanrenaud 07-26-2011 04:45 PM

but what's the difference to $post['message'] ?

BirdOPrey5 07-26-2011 05:05 PM

The difference for me is that $post['message'] didn't work on my tests. If it's working for you then don't worry about it. But I can confirm $this->post['pagetext'] works on both 3.8 and 4.x.

yjeanrenaud 11-03-2012 08:44 PM

thanks again


All times are GMT. The time now is 05:01 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.01023 seconds
  • Memory Usage 1,723KB
  • 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
  • (8)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