MyBB Community Forums

Full Version: Modify text in editor
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Murray, thanks so much for the reply. I have tried to play around with this for hours. and i am stuck. i can't even figure out where to add those hooks. What file do I put them in? Do i need to create my own plugin file?

And i also don't know which files to modify for rpgcharlist (do i modify PHP files or do this all through the admin area?)

Thanks so much for as much detail as you can give. i am going to mock up exactly what i am trying to do, just so i am clear.

When a user goes to make a new post i want to have two buttons on the left that say "add this text to the post" so the user can fill it in with their info. http://www.HoneyTrek.com/si/2015-03-20_1045.png

after click the text would be placed in the window on the right and user could fill in their name, address, etc
http://www.HoneyTrek.com/si/2015-03-20_1045.png

Thanks SO much!
Well, yes, if you want to build a plugin you need a plugin file - otherwise you just have… nothing!? You should really have a look into the example plugin!

In the top you can add the hooks like this:
$plugins->add_hook("newthread_start", "rpgchar_createlist");

This command means that the function "rpgchar_createlist" is called when mybb passes the "newthread_start" hook. After that you need to write the function, e.g.:
function rpgchar_createlist() {…}

In this function I access the global variable $rpgcharlist:
global $rpgcharlist
$rpgcharlist = "<option type='button'>foo bar</option>";

So after that I have a global variable with the wanted HTML code. Now you can put "{$rpgcharlist}" in the template (e.g. "newthread") to access the global variable from this template and show the HTML piece at this position.

Hope that helps, otherwise I would suggest you to get some easy/similar/simple plugins and try to read and understand the code, that helped me a lot to understand the system.
i manage add the buttons tho editor but i still have a problem with Mycode

i want add mycode to editor not in source mode

for example :

[mycode]my variable[/mycode]

thanks for help Heart
You mean you want to hide the "[mycode]"-Tags? Sorry, can't help there, I guess you need to modify the JavaScript text editor for that.
Pages: 1 2