MyBB Community Forums

Full Version: Question about Mycodes before I even try one...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've thought about adding a mycode but I wanted to see if it was even possible to do so. Looking at the examples setup in the official documentation it doesn't look possible...so here is the question.


I'm going to attempt to link people to an online gaming site that has the items they're attempting to describe...so in this case the mycode would link them to a URL.

For example:

\[d3](.*?)\[/d3\]

<a href="http://us.battle.net/d3/en/item/$1">$1</a>

Now this looks pretty straight forward....but there's a problem. Not all items are a single word....and the URL's at the end point don't allow spaces.

So if you input 'item name' in between your tags, it will 404 every time...it's actually looking for 'item-name' instead.

I know you can't parse regex in html...so my question is, is it possible to do this another way? If not, I'm not even going to waste time on it and I'll try this another way.

Thanks for any help anyone can provide....
What I would recommend doing is creating a plugin and having it use one of the hooks of inc/class_parser.php. This way you can use PHP code. I would recommend the parse_message_end hook so it will execute after all other codes have been parsed.
Thanks for pointing me in the right direction. I'll give it a go and see what I can do Smile