HMBeaty
07-05-2011, 12:08 AM
Ok, this is my 1st time playing around with str_replace and I'm obviously doing SOMETHING wrong as my code isn't working lol
Basically what I'm trying to do, is turn this (https://vborg.vbsupport.ru/showthread.php?t=240389) into an automatic template edit, and eventually do the same with most of my personal modifications which haven't and won't be released here. So no need to worry about if user x installs on a custom style, he/she may run into problems later. :)
Anyway, on with the codes :D
Currently, I have this in a plugin
$find = '<vb:if condition=\"$post['signature']\">';
$replace = '<vb:if condition=\"$post['signature'] AND !$vboptions['shownsigs'][$post[userid]] AND $vboptions['shownsigs'][$post[userid]] = true\">';
$output = str_replace($find,$replace.$find, $output);Which probably isn't right, but a lot of the threads I've searched through for vB 4 str_replace are incomplete as far as an official WORKING answer.
Now, with the code above, I've tried using the hook locations:
global_start
showthread_start
parse_templates
showthread_postbit_create
postbit_display_start
postbit_display_complete
showthread_completeWhich seem to be the most logical ones to use for this modification, but it still isn't working. So, to me, that HOPEFULLY narrows it down to my code not being correct.
So, my next question is, what's wrong with it? :confused:
/ str_replace noob :D
Basically what I'm trying to do, is turn this (https://vborg.vbsupport.ru/showthread.php?t=240389) into an automatic template edit, and eventually do the same with most of my personal modifications which haven't and won't be released here. So no need to worry about if user x installs on a custom style, he/she may run into problems later. :)
Anyway, on with the codes :D
Currently, I have this in a plugin
$find = '<vb:if condition=\"$post['signature']\">';
$replace = '<vb:if condition=\"$post['signature'] AND !$vboptions['shownsigs'][$post[userid]] AND $vboptions['shownsigs'][$post[userid]] = true\">';
$output = str_replace($find,$replace.$find, $output);Which probably isn't right, but a lot of the threads I've searched through for vB 4 str_replace are incomplete as far as an official WORKING answer.
Now, with the code above, I've tried using the hook locations:
global_start
showthread_start
parse_templates
showthread_postbit_create
postbit_display_start
postbit_display_complete
showthread_completeWhich seem to be the most logical ones to use for this modification, but it still isn't working. So, to me, that HOPEFULLY narrows it down to my code not being correct.
So, my next question is, what's wrong with it? :confused:
/ str_replace noob :D