Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[For 1.8.15] MyBadge
#1
Quote:Exclamation This Mycode was tested on MyBB 1.8.15 (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.
Code:
Badge (or any name you desire)
Short Description - I use this as a help text. I do not recommend changing this.
Code:
[badge]SUBJECT-STATUS-COLOR[/badge]
Regular Expression - Do not change this.
Code:
\[badge\](.*?)\-(.*?)\-(.*?)\[/badge\]
Replacement - Do not change this.
Code:
<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.
Best Regards,
Robert

[Image: Y1db4R6.gif]
Reply
#2
Exclamation This MyCode has been tested and works for MyBB 1.8.15
Best Regards,
Robert

[Image: Y1db4R6.gif]
Reply
#3
Nice code Smile
MyBB Translator & helper
Please do not PM me requesting free support or help for your forums.
You can see my paid services here.
Reply
#4
Why does the regular expression allows for anything even though not necessary ?
Reply
#5
(03-20-2018, 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?
Best Regards,
Robert

[Image: Y1db4R6.gif]
Reply
#6
(03-20-2018, 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.
Reply
#7
If you use this code "as is", it allows me to insert the following:
Code:
[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.
Reply
#8
(04-06-2018, 03:19 AM)Omar G. Wrote: If you use this code "as is", it allows me to insert the following:
Code:
[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.
MyBB Translator & helper
Please do not PM me requesting free support or help for your forums.
You can see my paid services here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)