DragonByte Tech
Well-known member
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.
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:
Upvote
0