MyBB Community Forums

Full Version: MyCode Request/Help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ok, what I would like to do is have a custom mycode for magnet links. They already work fine with mybb when you add them as a regular link but what I want is this..

[ magnet=magnet:URL]name of magnet link[ /magnet]

Would result in this..
[Image: message22xf.th.gif]

The html would be something like..
<a href="magnet:URL"><img src="imgages/magnet.gif">name of magnet link</a>

I would also love to have a post button like this..
[Image: message1xt.th.gif]

I have really no experience with php besides applying mods so I have no clue where to start as far as actually coding it. Please, somebody help me or lead me in the right direction. I tried installing the custom mycode plugin but that was a disaster.
Take a look at the spoiler tag plugin. You should be able to modify it to your needs with just a real simple understanding of php.

You can find it here

It was written by Michael83
Try this mod http://mods.mybboard.com/view.php?did=166 . Not sure if it'll suit your needs.
Quote:I tried installing the custom mycode plugin but that was a disaster.
Quote:Try this mod http://mods.mybboard.com/view.php?did=166 . Not sure if it'll suit your needs.

I dont quite understand what you mean by magnet link, could you elaborate what a magnet link does?
Ah sorry didn't read that.
I did a quick google and this came up http://magnet-uri.sourceforge.net/ ?
Uhm... I'm not working on my own pc right now so I can't really make you something, but I can tell you how to do it. If you don't bother editing files, you can do this:

Open functions_post.php (make a backup first) and look for something like this:
Do not copy this line, because it might not be correct. I don't have the files!
$message = preg_replace("#\[email=(*.?)\](*.?)\[/email\]#si","<a href=\"mailto:$1\">2</a>",$message);
Copy it to the line under it and change some stuff so the line becomes like this:
$message = preg_replace("#\[magnet=(*.?)\](*.?)\[/magnetl\]#si","<a href=\"magnet:$1\"><img src=\"images\magnet.gif\"></img>$2</a>",$message);

I can't remember how to create a codebutton right now, but this should already make the tag work. If you want to create a plugin, and you know a bit how to, you should hook on "parse_message" and add the line into the plugin function. I might create a plugin later tonight.
The plugin is finished. Here is the link: http://smethead.louhabs.com/mods.php?mid=4
lol, he hasn't come back yet