MyBB Community Forums

Full Version: Add custom MyCode icons to editor tool bar
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All,

I had been searching for a way to add a custom mycode icon to the editor toolbar, I found the following info...

http://community.mybb.com/thread-64465.html

http://community.mybb.com/thread-64437-p...#pid462596

but I was still stuck, I have limited knowledge and the above looked a little complexed.

I found an easy way to add custom mycode icons by just editing a plugin...

1. Download and install sr mybbcoder (Check this app is enabled and working)

2. In your server control panel find... inc/plugings/sr_mybbcoder.php

3. Edit this file with "code editor" and search for...
'function' => 'script(\'[sub]\', \'[/sub]\')' );
replace both sub parts with the mycode you want. In my case I used pgn. so I replaced this line with...
'function' => 'script(\'[pgn]\', \'[/pgn]\')' );

4. Find
$message = preg_replace( "#\[sub\](.*?)\[/sub\]#is", '<pgn>$1</pgn>', $message );
and again replace the sub with the mycode of your choice, in my example this looks like
$message = preg_replace( "#\[pgn\](.*?)\[/pgn\]#is", '<pgn>$1</pgn>', $message );

5. Save.

This should now work, go to your forum and test by clicking on the SubScript button. (In your mybb Admin Control Panel You may need to uninstalled and reinstall the plugin)

There are 2 problems that I will solve for you now...

1. when you hover the mouse arrow over the sub script icon it still says "Install Subscript" to fix this

1.1 Goto server CP and find inc/languages/english/sr_mybbcoder.lang.php

1.2 Edit this file with Code Editor and search for...
= 'Insert subscript.';
and replace 'Insert subscript' with any text you like, my example is like this...
= 'Insert PGN.';
1.3 Save and test, plugin may need uninstalling and reinstalling in mybb admin cp again.

2. The picture will be a sub script icon.

2.1 Goto server CP and find inc/plugins/sr_mybbcoder

2.2 delete the file sub.png, upload the icon you wish to use (I used a .png file and it worked fine for me) then rename that file sub.pgn.

There you go, you now have custom mycode icons in your postbit. I have changed both subscript and supscript icons to new custom ones this way, I see no reason why this guide (with a little adapting) wouldn't work with all the icons in the mybbcoder plugin.

Finally you can turn off all the icon you don't wish to use in the Admin CP under configuration and mybbcoder

Have a look how this works on my forum....

http://the-chess-forum.com/Thread-New-ta...e-post-bit

Feel free to post so you can test for yourself.

Note, I did this using mybb version 1.6.2

If you need any help simply reply to this thread, I have email notification on.

I hope this helps a few members,

Oliver
http://the-chess-forum.com
Exactly what I needed! Great , thank you so much!
(2011-09-10, 09:25 PM)t3kla Wrote: [ -> ]Exactly what I needed! Great , thank you so much!

Thanks for your feedback t3kla. I searched for ages to try and solve this, in the end I came up with the way listed above. I wanted to share it with everyone, I'm glad it has been of help.
not working on mybb 18. there is any port to this version?