31/03/2015 - Shortcode system.

by Melancholy

Melancholy
すけべ
Admin
Posts: 3,871
Threads: 213
Joined: Jul 2014
Reputation: 60
03-30-2015, 09:42 AM (This post was last modified: 03-30-2015, 09:47 AM by Melancholy.)
#5457 (1)
I've integrated WordPress's shortcode system with MyBB.

While this might not mean much to you, it means I can rapidly create bbcodes with far advanced functionality than the default system alone offers.

Here are some of the new "shortcodes" that are available to you:
Code:
[spoiler]
This is a basic spoiler without any options.
[/spoiler]

Which returns a basic spoiler (I'll be making it stay open on click tomorrow, just put this together quickly before bed).

Spoiler

This is a basic spoiler without any options.

You can also add a title to your spoiler, like this:
Code:
[spoiler title="My Spoiler"]
This is a spoiler with a title.
[/spoiler]

My Spoiler

This is a spoiler with a title.

There's even an option for a nsfw spoiler.
Code:
[spoiler mode="nsfw"]
mis's nudes go here
[/spoiler]

Spoiler

mis's nudes go here

And of course, you can give it a title:
Code:
[spoiler title="mis's nudes" mode="nsfw"]
mis's nudes go here
[/spoiler]

mis's nudes

mis's nudes go here

There's the username shortcode.
Code:
[username]
Which returns the logged in user's username: (future member)

The hide shortcode.
Code:
[hide]hidden content[/hide]


And more to come!

jokatk
420 燃やせ
Kohai
Posts: 128
Threads: 6
Joined: Feb 2015
Reputation: 0
03-30-2015, 02:13 PM
#5459 (2)
awww yisss senpai finaly we got sum gud spoiler codes

[Image: 687474703a2f2f612e706f6d662e73652f7474676c6c622e706e67]
>tfw new theme

Lokorfi
Waifu
Posts: 2,671
Threads: 30
Joined: Feb 2015
Reputation: 32
03-30-2015, 02:41 PM
#5460 (3)

senpai is qt





ily


mumu
lil' fox
bulli
Posts: 1,027
Threads: 71
Joined: Dec 2014
Reputation: 10
03-30-2015, 04:04 PM (This post was last modified: 03-30-2015, 04:04 PM by mumu.)
#5464 (4)

ok


okay


can we make the spoilers onclick instead of onmouseover?

[Image: 68747470733a2f2f696d672e62757a7a66656564...362e676966]
Melancholy
すけべ
Admin
Posts: 3,871
Threads: 213
Joined: Jul 2014
Reputation: 60
03-30-2015, 04:11 PM
#5465 (5)
(03-30-2015, 04:04 PM)mumu Wrote:

ok


okay


can we make the spoilers onclick instead of onmouseover?

Spoiler

(03-30-2015, 09:42 AM)Senpai Wrote: (I'll be making it stay open on click tomorrow, just put this together quickly before bed).

Senka
Loli lover
Kitsune
Posts: 132
Threads: 3
Joined: Dec 2014
Reputation: 6
03-30-2015, 05:07 PM
#5466 (6)

my noods


[Image: 68747470733a2f2f666f6f64636f6d61732e6669...352e6a7067]

I know, old joke. but i never got to participate ;_;



[Image: 68747470733a2f2f6c6577642e6865726f6b7561...366536372f]
Melancholy
すけべ
Admin
Posts: 3,871
Threads: 213
Joined: Jul 2014
Reputation: 60
03-30-2015, 05:28 PM
#5467 (7)
(03-30-2015, 05:07 PM)Senka Wrote:

my noods


[Image: 68747470733a2f2f666f6f64636f6d61732e6669...352e6a7067]

I know, old joke. but i never got to participate ;_;



your noods are hot

mumu
lil' fox
bulli
Posts: 1,027
Threads: 71
Joined: Dec 2014
Reputation: 10
03-30-2015, 07:34 PM (This post was last modified: 03-30-2015, 07:38 PM by mumu.)
#5468 (8)
future member spooky magic



Spoiler

how exactly does [ username ] work

[Image: 68747470733a2f2f696d672e62757a7a66656564...362e676966]
Melancholy
すけべ
Admin
Posts: 3,871
Threads: 213
Joined: Jul 2014
Reputation: 60
03-30-2015, 08:33 PM (This post was last modified: 03-30-2015, 08:36 PM by Melancholy.)
#5469 (9)
(03-30-2015, 07:34 PM)mumu Wrote: future member spooky magic



Spoiler

how exactly does [ username ] work

This is the code for it. :^)
PHP Code:
function shortcode_username($params$content) {
    global 
$mybb;

    if (
$content) { // this does not require any content.
        
return false;
    }

    if(
$mybb->user['uid']) {
        return 
$mybb->user['username'];
    } else {
        return 
"future member";
    }

}

Shortcodes::add("username""shortcode_username"); 

I'll likely release the shortcodes plugin for free.

EDIT, btw, you can escape the shortcodes by wrapping them in brackets: [username]
Code:
[[username]]

garett
LⅡ's Slave
Mikstake
Posts: 89
Threads: 8
Joined: Feb 2015
Reputation: 2
03-30-2015, 10:00 PM
#5470 (10)
>mfw this updates 
[Image: 687474703a2f2f692e696d6775722e636f6d2f76...6e2e676966]

Well done. ily, @Senpai.

ily future member :heart:
mis
meme halation
Waifu
Posts: 1,800
Threads: 190
Joined: Jul 2014
Reputation: 27
03-30-2015, 11:33 PM (This post was last modified: 03-30-2015, 11:33 PM by mis.)
#5471 (11)

Spoiler

senpai a bulli, never gib permission to share those

What if we want to give nsfw spoilers a title?

[Image: 687474703a2f2f692e696d6775722e636f6d2f6a...742e706e67]
Melancholy
すけべ
Admin
Posts: 3,871
Threads: 213
Joined: Jul 2014
Reputation: 60
03-31-2015, 12:05 AM
#5472 (12)
(03-30-2015, 11:33 PM)mis Wrote:

Spoiler

senpai a bulli, never gib permission to share those

What if we want to give nsfw spoilers a title?

You can.

mis ily

pls marry me mis  :heart:

jokatk
420 燃やせ
Kohai
Posts: 128
Threads: 6
Joined: Feb 2015
Reputation: 0
03-31-2015, 08:54 AM (This post was last modified: 03-31-2015, 08:55 AM by jokatk.)
#5473 (13)
@Senpai @mumu today i learned that the whole forum doesn't talk about me :((

Do you love me future member ?

[Image: 687474703a2f2f612e706f6d662e73652f7474676c6c622e706e67]
>tfw new theme

Senka
Loli lover
Kitsune
Posts: 132
Threads: 3
Joined: Dec 2014
Reputation: 6
03-31-2015, 04:44 PM
#5475 (14)
(03-31-2015, 08:54 AM)jokatk Wrote: @Senpai @mumu today i learned that the whole forum doesn't talk about me :((

Do you love me future member ?

Don't be a bulli on yourself!

I absolutely love you, jokatk :heart:

[Image: 68747470733a2f2f6c6577642e6865726f6b7561...366536372f]
Melancholy
すけべ
Admin
Posts: 3,871
Threads: 213
Joined: Jul 2014
Reputation: 60
03-31-2015, 05:02 PM
#5476 (15)
(03-31-2015, 08:54 AM)jokatk Wrote: @Senpai @mumu today i learned that the whole forum doesn't talk about me :((

Do you love me future member ?

Maybe you should join the Slack :^)