Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
use mycode to replace bad <img tag after migration
#1
Ok, I just migrated over from IPB 3.4.x. I've use MyCodes to replace a few things that didn't quite work as planned in the migration, but I can't figure this out...because it works in the AdminCP 

here's my regular expression...I know it seems very specific, but that's because ever instance is consistent:

Code:
\<img src='http:\/\/www\.titanspot\.com\/Titan\/public\/style_emoticons\/<(.*?)>\/(.*?)\.(.*?)' class='bbc_emoticon' alt='(.*?)' />

My replacement is simply this:

Code:
<img src='/mybb/uploads/style_emoticons/default/$2.$3' />


In the MyBB Sandbox test value, I enter this:
Code:
<img src='http://www.titanspot.com/Titan/public/style_emoticons/<#EMO_DIR#>/002.gif' class='bbc_emoticon' alt=':smt002' />
and get this as expected: 
Code:
<img src='/mybb/uploads/style_emoticons/default/002.gif' />

But nothing happens in the actual forum.  Any idea what I'm missing here?
Reply
#2
Hi,

I am not saying that I am 100% correct on this, but the format for the regular expression should be:
Code:
\[Mycode\](.*?)\[/Mycode\]
BBcodes use brackets "[ ] [/]" to convert HTML code. I am not sure if your method will work if the regular expression is not like that. If you are hoping that MyCode will convert messed up html when it's not in bbcode format will not do anything and you have to manually use what you want to bbcode format. The merge system needs to be updated with the HTML conversion problem. Have a staff member confirm this, but that is what my view on why this is not working.
Best Regards,
Robert

[Image: Y1db4R6.gif]
Reply
#3
This might be a situation where you want to run an sql query to update the database table instead of reparsing it everytime the post is shown.
Reply
#4
I think you're better off with a word filter instead.
Reply
#5
I have a simple solution to your problem: https://community.mybb.com/thread-216166...pid1298379
Best Regards,
Robert

[Image: Y1db4R6.gif]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)