Sometimes in the lastpost bit on forumdisplay you may notice odd strings due to bbcode, the following replace will strip all bbcode from the lastpost bit.
Another way to go about this would be using replaces for each bbcode, this would allow users to see there is something there, but they must open the thread to see the full content:
Code:
$LastPostVar = preg_replace('~\[(img|url|code|h2|span|div|and|any|other|codes|to|omit)\b[^]]*](.*?)\[/\1]~is', '', $LastPostVar);
Another way to go about this would be using replaces for each bbcode, this would allow users to see there is something there, but they must open the thread to see the full content:
Code:
$find = ['/\[img\](.*)\[\/img\]/im', '/\[url.*\](.*)\[\/url\]/im'];
$replace = ['*IMAGE*', '*LINK*'];
$LastPostVar = preg_replace($find, $replace, $LastPostVar);
Last edited: