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

As designed load_class_bb_code Event Listener Not Always Called


Well-known member
When loading the BBCode class, the load_class_bb_code event listener isn't firing (probably loading the class direct instead of via loader?)...

Specifically if you edit a post, the AJAX editor that is overlayed doesn't have it fired, nor is the editor if you if you click on "More Options..." from that AJAX overlay.

Actually, now that I test... it just seems like it's not firing anytime for things within the WYSIWYG editor.

Jake Bunce

XenForo moderator
Staff member
I see no reason for this. Which class are you extending? The inline post editor would use XenForo_BbCode_Formatter_Wysiwyg (assuming the rich editor is active).


Well-known member
It's XenForo_BbCode_Formatter_Base... Again, it works fine when viewing a thread, but not within the editor. All I'm really doing it wrapping a <span> around the smilie images...

class DigitalPointLittleThings_BbCode_Formatter_Base extends XFCP_DigitalPointLittleThings_BbCode_Formatter_Base
	protected $_smilieSpriteTemplate = '<span class="smileWrapper"><img src="styles/default/xenforo/clear.png" class="mceSmilieSprite mceSmilie%1$d" alt="%2$s" title="%3$s    %2$s" /></span>';

Jake Bunce

XenForo moderator
Staff member
The thread view uses "Base":


Rich (BB code):
		$bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
The inline post editor uses "Wysiwyg":


Rich (BB code):
				$bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Wysiwyg', array('view' => $view)));
That's why your extended class isn't working. You would have to extend "Wysiwyg" as well in your "load_class_bb_code" listener. Even though Wysiwyg extends Base, your extended Base class will only work when Base is created in the loader. So you need to name the other formatters as well.

Also, this might be relevant when you extend the other formatters:


I am going to call this "as designed" but leave it in the bug forum so the devs can have the final word.