This can't be done in the Replacement for the BB Code. Nothing can be in the replacement other than HTML code. PHP or conditionals just don't work.
I actually have a system like this on my forum. I have an "article" bb code that embeds an article into an IFRAME and displays it in a post. I have a custom profile field where users can disable the iframe if they choose.
My "solution" was a plugin on postbit_display_complete. It does a string replace (or preg_replace) on the "Replacement" text of the BB Code...
The variable is $post['message']
This holds the HTML of the post. So remember you're not searching for "[B]" but "<b>."
It is an annoying and convoluted way of doing things but it works.
Also besides postbit you also have to scan for the "preview" and the "review" bits as well since the post might be rendered on those pages too.
|