PDA

View Full Version : Seems like an easy bbCode mod?


Lord KoT
02-14-2013, 04:28 AM
Back in my earlier installs, I had this mod (https://vborg.vbsupport.ru/showthread.php?t=49458) which basically replaces the code "you" (in square brackets, not quotes) with the name of the logged in user. I wasn't able to figure out how to do this with vb3.x and I've just upgraded to 4.x and still cannot figure it out. Can anyone point me in the right direction, or better yet, show me how it's done?

Much thanks =)

kh99
02-14-2013, 11:35 AM
I don't know if it exists or not, but the reason it's not so easy to do with bbcodes is that posts are cached after the bbcodes are processed, so you'd need some way to prevent a post from being cached if it contained a "you" bbcode.

I haven't tried it, but you might be able to cheat by creating a plugin using hook postbit_display_start and code like:

$post['message'] = str_ireplace('[you]', htmlspecialchars_uni($this->registry->userinfo['username']), $post['message']);

Lord KoT
02-18-2013, 09:38 AM
When you describe it that way, I can see why it might not be so easy. Originally I dont think it was a BB code mod and so your suggestion may have been the way it was done. I just don't have the expertise to delve where the new spots to add the magic code in the files has run off to. Thanks for the help =)