Creating Custom MyCode is quite easy once you understand how it works. Here's a quick overview on how to make Custom MyCode:
First, go to your Admin CP and then to the Message Filters, Custom MyCode, and to Add MyCode.
Note: If a user is to, for instance, not enter the title in the example above, the MyCode will not work - so if you would want something where users do not have to enter said details, then you should create multiple versions of the same thing, with/without the options.
First, go to your Admin CP and then to the Message Filters, Custom MyCode, and to Add MyCode.
- MyCode title
- That's just the name of the MyCode, fairly simple.
- MyCode description
- A basic description of what the MyCode is for; what it does.
- Regular expression
- This gets a bit more complicated. On the page, we are given this example:
\[b\](.*?)\[/b\]
You need to have the \ before the [ and ] so it will work properly. If you imagine it without the \ it looks very basic:
[b](.*?)[/b]
Of course, you will still need the \ back in there for it to work properly without errors, but you can add those back later before you submit it.
- I believe (I'm not an expert on this, but it's worked for me so far) that you put the (.*?) each time you want a variable - something the user fills in when using the MyCode. So, for instance, we could have this:
\[a\ href=(.*?) title=(.*?)\](.*?)\[/a\]
Which would be essentially just like the links in HTML. Now, let's look at the next option:
- This gets a bit more complicated. On the page, we are given this example:
- Replacement
- This is what you want the MyCode to be once the user enters it in. So, for our previous example of the links, you would enter in this:
<a href="$1" title="$2">$3</a>
- Basically, all you do is for each (.*?) you put in previously, you put in an incremented variable (such as $1, $2, and $3). It's actually quite simple to understand once you get the hang of it!
- This is what you want the MyCode to be once the user enters it in. So, for our previous example of the links, you would enter in this:
- Activate MyCode
- This lets you turn it off without deleting it.
- This lets you turn it off without deleting it.
Note: If a user is to, for instance, not enter the title in the example above, the MyCode will not work - so if you would want something where users do not have to enter said details, then you should create multiple versions of the same thing, with/without the options.