MyBB Community Forums

Full Version: [For 1.8.19] MyBadge
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Quote:Exclamation This Mycode was tested on MyBB 1.8.19 (The lastest stable release) and displays correctly. There is no guarantee that the code will work for any outdated versions. Make sure you have the most stable version of MyBB.


Hi Folks,

I have converted a Badge BBcode from a different forum software that I used before and loved it. I want to share this Mycode with you guys to enjoy it for your forum.

The MyCode uses this as a resource: https://shields.io

The above resource is an exact preview of what the badges will look like, but you have full control on the subject, status (Versions like v1.0,v1.3, etc.), and color (name like blue, green, etc.)

Step 1
Admin CP -> Configuration -> MyCode -> Add New MyCode
You should see the page where you can add a new MyCode. Once you are there, you may proceed to step 2.

Step 2
Now we will input some information to get the MyCode from working. Make sure you copy & paste carefully. If you miss a letter or change the coding, it will not work. Please be diligent with the information provided. Only 
Title - You may change the name to what you desire.
Badge (or any name you desire)
Short Description - I use this as a help text. I do not recommend changing this.
[badge]SUBJECT-STATUS-COLOR[/badge]
Regular Expression - Do not change this.
\[badge\](.*?)\-(.*?)\-(.*?)\[/badge\]
Replacement - Do not change this.
<img src="https://img.shields.io/badge/$1-$2-$3.svg" alt="" style="margin-bottom: -5px;" />
Actual Result
[Image: 0e88f74457be654f7e0cbbec28dc7650.png]

Purpose of MyCode
  • Perfect for plugin/theme developers to make their threads more professional with changelogs and versions.
  • Want to make badges in your post as titles or prefixes within a thread.
  • Other possibilities that might fulfill your needs.
I hope this MyCode does well for this community and hope to introduce this everyone. I really love the flat design of these badges. Sorry for this lengthy MyCode tutorial, I wanted to be detailed and make it simple for MyBB beginners.

Please inform me in this thread if you find any problems with this tutorial. For instance, MyBB versions change the MyCode format, Tutorial was not clear enough, or I am missing content for this MyCode to function correctly.

Legal Disclaimer/Credit: This BBcode was originally made for the phpBB by DMZX using the above open resource. All rights go to the project sheild.io! DMZX converted it to phpBB BBcode. I did the conversion to make the BBcode compatible to MyBB.
Exclamation This MyCode has been tested and works for MyBB 1.8.15
Nice code Smile
Why does the regular expression allows for anything even though not necessary ?
(2018-03-20, 12:43 AM)Omar G. Wrote: [ -> ]Why does the regular expression allows for anything even though not necessary ?

I do not quite understand your question?
(2018-03-20, 12:43 AM)Omar G. Wrote: [ -> ]Why does the regular expression allows for anything even though not necessary ?

It doesn't? I include the dashes in the regex to filter out incorrect ones.
If you use this code "as is", it allows me to insert the following:
[badge]v1.0.0-88 Issues Open-blue.svg" style="width: 100%; height: 100%;position: fixed;z-index:999999;top: 0;left: 0;" /><img src="https://img.shields.io/badge/v2.0.0-1 Issues Open-red.svg" style="width: 100%; height: 100%;position: fixed;z-index:999999;top: 0;left: 0;" title="[/badge]

Since I could insert one extra image tag with no issues, I suppose I could as well insert frames or whatnot.

Try to read the following (first result):
https://code.tutsplus.com/tutorials/you-...--net-7869

Which actually points you to what seems once was a desktop app but is now a web app instead.
https://regexr.com

You don't need to go too deep, I suppose using \w \d \s or one for more complex "sentences" should suffice.
(2018-04-06, 03:19 AM)Omar G. Wrote: [ -> ]If you use this code "as is", it allows me to insert the following:
[badge]v1.0.0-88 Issues Open-blue.svg" style="width: 100%; height: 100%;position: fixed;z-index:999999;top: 0;left: 0;" /><img src="https://img.shields.io/badge/v2.0.0-1 Issues Open-red.svg" style="width: 100%; height: 100%;position: fixed;z-index:999999;top: 0;left: 0;" title="[/badge]

Since I could insert one extra image tag with no issues, I suppose I could as well insert frames or whatnot.

Try to read the following (first result):
https://code.tutsplus.com/tutorials/you-...--net-7869

Which actually points you to what seems once was a desktop app but is now a web app instead.
https://regexr.com

You don't need to go too deep, I suppose using \w \d \s or one for more complex "sentences" should suffice.

Agree to this one.
[Image: exclamation.gif] This MyCode has been tested and works for MyBB 1.8.19

Sorry for missing the last few updates! I was away from forums for a while. Enjoy Smile
Good Performance, Thank You

+1