Advertisement:

Author Topic: Restrictive BBCode  (Read 4003 times)

Offline ~Killer~

  • Jr. Member
  • **
  • Posts: 101
Restrictive BBCode
« on: February 16, 2009, 06:18:12 AM »
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...

Offline Kermit

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,365
  • Gender: Male
Re: Restrictive BBCode
« Reply #1 on: February 16, 2009, 07:02:38 AM »
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

Offline ~Killer~

  • Jr. Member
  • **
  • Posts: 101
Re: Restrictive BBCode
« Reply #2 on: February 16, 2009, 10:04:05 AM »
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!

Offline ~Killer~

  • Jr. Member
  • **
  • Posts: 101
Re: Restrictive BBCode
« Reply #3 on: February 17, 2009, 11:59:16 AM »
That didn't work :'(

Offline ~Killer~

  • Jr. Member
  • **
  • Posts: 101
Re: Restrictive BBCode
« Reply #4 on: February 19, 2009, 05:43:03 AM »
Bump.

Offline Kermit

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,365
  • Gender: Male
Re: Restrictive BBCode
« Reply #5 on: February 19, 2009, 05:57:28 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

Offline ~Killer~

  • Jr. Member
  • **
  • Posts: 101
Re: Restrictive BBCode
« Reply #6 on: February 20, 2009, 05:06:30 PM »
:S Well it's not working... Could you do it for me, I swear it's not working.

Offline Mr. Jinx

  • Full Member
  • ***
  • Posts: 475
  • Gender: Male
    • Ziggo Forum Chelloo
Re: Restrictive BBCode
« Reply #7 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]
« Last Edit: March 30, 2009, 02:16:43 PM by Mr. Jinx »

Offline buspass

  • Semi-Newbie
  • *
  • Posts: 36
Re: Restrictive BBCode
« Reply #8 on: March 31, 2009, 10:35:44 AM »
What about disabling a tag like (url)(/url) either by membergroup or for a specific board?

Offline Mr. Jinx

  • Full Member
  • ***
  • Posts: 475
  • Gender: Male
    • Ziggo Forum Chelloo
Re: Restrictive BBCode
« Reply #9 on: April 11, 2009, 04:03:14 AM »
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?

Offline Bulakbol

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,220
  • Gender: Male
  • JohnyB
Re: Restrictive BBCode
« Reply #10 on: April 15, 2009, 04:46:54 AM »
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