• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Lack of interest Expose content context to the Custom BB Code callbacks

DragonByte Tech

Well-known member
#1
I'm creating a plugin that needs a PHP callback that depends on knowing the context of the BB Code, e.g. whether it's in a post, a signature, or some other content type another mod has created.

As far as I can tell, there's no way to actually discern the context reliably. I can guess the thread based on the view parameter, but I can't actually tell which content_type and content_id this BB Code is being parsed in.

I can work around this issue just now by creating a new DB table, parsing the content of the BB Code in DiscussionMessage_post::messagePostSave() and saving the md5 value of the BB Code contents in said table, then compare the parsed BB Code tag contents on thread view to the stored value in the DB table.

The fact that that explanation barely made sense to me, the guy who programmed it 5 minutes ago, should serve as an indication why this is needed.
 
Last edited:

Chris D

XenForo developer
Staff member
#2
I don't disagree. Just wanted to note this limitation isn't currently exclusive to custom bb code. The core bb code system isn't context aware either.