Restrictive BBCode

Started by ~Killer~, February 16, 2009, 06:18:12 AM

Previous topic - Next topic

~Killer~

Well I'm using SMF 2.0 BETA 4 (I don't want to upgrade yet, for various reasons), and I have a few BBCodes (ModBreak specificly) that I want to restrict to just Moderators and Administrators to use, but how exactly can I do this, I don't want to let other regular members use it, just Mods...

Kermit

You can try that

Sources/Subs-Post.php

Code (find) Select

if (!$previewing && strpos($parts[$i], '[html]') !== false)
{
if (allowedTo('admin_forum'))
$parts[$i] = preg_replace('~\[html\](.+?)\[/html\]~ise', '\'[html]\' . strtr(un_htmlspecialchars(\'$1\'), array("\n" => \'
\', \'  \' => \'  \')) . \'[/html]\'', $parts[$i]);
// We should edit them out, or else if an admin edits the message they will get shown...
else
{
while (strpos($parts[$i], '[html]') !== false)
$parts[$i] = preg_replace('~\[[/]?html\]~i', '', $parts[$i]);
}
}




Code (replace with) Select

if (!$previewing && strpos($parts[$i], '[html]') !== false)
{
if (allowedTo('admin_forum'))
$parts[$i] = preg_replace('~\[html\](.+?)\[/html\]~ise', '\'[html]\' . strtr(un_htmlspecialchars(\'$1\'), array("\n" => \'
\', \'  \' => \'  \')) . \'[/html]\'', $parts[$i]);
// We should edit them out, or else if an admin edits the message they will get shown...
else
{
while (strpos($parts[$i], '[html]') !== false)
$parts[$i] = preg_replace('~\[[/]?html\]~i', '', $parts[$i]);
}
}

    if (!$previewing && strpos($parts[$i], '[modbreak]') !== false)
{
if (allowedTo('moderate_board'))
$parts[$i] = preg_replace('~\[modbreak\](.+?)\[/modbreak\]~ise', '\'[modbreak]\' . strtr(un_htmlspecialchars(\'$1\'), array("\n" => \'
\', \'  \' => \'  \')) . \'[/modbreak]\'', $parts[$i]);
// We should edit them out, or else if an admin edits the message they will get shown...
else
{
while (strpos($parts[$i], '[modbreak]') !== false)
$parts[$i] = preg_replace('~\[[/]?modbreak\]~i', '', $parts[$i]);
}
}
My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

~Killer~

Thanks alot, I'll try that later and tell ya if it works ^_^

So I'll just replace "ModBreak" with the name of the BBCode for another one? Great!

~Killer~


~Killer~


Kermit

Quote from: ~Killer~ on February 17, 2009, 11:59:16 AM
That didn't work :'(

But it should work,i've tested it on my test forum,it's worked flawless
My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

~Killer~

:S Well it's not working... Could you do it for me, I swear it's not working.

Mr. Jinx

#7
Thanks Duncan85. This works very nice (SMF 1.1.8!) in combination with the modbreak mod. 8)

Would it also be possible to filter things like [modbreak=test]bla bla[/modbreak] ?
Currently it filters [modbreak]bla bla[/modbreak]

buspass

What about disabling a tag like (url)(/url) either by membergroup or for a specific board?

Mr. Jinx

Quote from: Mr. Jinx on March 30, 2009, 02:08:32 PM
Thanks Duncan85. This works very nice (SMF 1.1.8!) in combination with the modbreak mod. 8)

Would it also be possible to filter things like [modbreak=test]bla bla[/modbreak] ?
Currently it filters [modbreak]bla bla[/modbreak]

Anyone please?

Bulakbol

The best place to ask about modbreak mod is the author in the support/comment topic. Please post your issue here.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Advertisement: