News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Permissions for BBC, or another way to remove certain BBC buttons?

Started by Dwev, January 12, 2018, 10:52:20 PM

Previous topic - Next topic

Dwev

As far as I can see/find it used to be possible (with a Mod) to set permissions for BBC codes, but they aren't compatible with 2.0.xx.

I would like to be able to use most codes, but I want to show the users only a selection.
Turning certain codes off doesn't work, because it means that the codes can't be used anymore.

Making the button the color of the background seems to be the 'best' option so far (not exactly great), but maybe there is another solution?

Kindred

No, your bets option would be to remove the option from the bbc button creation array
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Dwev

But that means that the code isn't useable anymore, so not really an option...  :(

Arantor

No, if you remove it from the array in the editor, it just means the button doesn't get shown.

Dwev

@ Arantor: if that were true I wouldn't ask.

Just tried switching off the float BBC-code and images are immediately not floated to the left or right anymore.
The code came from this mod, so might this be a problem of that mod specifically?

Arantor

You're misunderstanding what we're saying.

There are two places bbcode are listed. One is in Subs.php, where the master bbc itself is defined. The other is in Subs-Editor.php which contains the list of buttons. You can remove them from Subs-Editor.php and they will be removed from the editor without them removed from functioning as bbcode.

There are plenty of bbcode that aren't given editor buttons, like tables - they're just not present in the Subs-Editor.php list.

Dwev

@ Arantor: you're right, I understood that completely wrong.

But now I got it, so thanks a lot, I'm off to the Subs-Editor.php..!   ;)

Dwev

Hmm, can someone give me a pointer to what to edit exactly in Subs-Editor.php to stop a button from showing?

Arantor

This is the list from a mostly stock 2.0.14:


if (empty($context['bbc_tags']))
{
// The below array makes it dead easy to add images to this control. Add it to the array and everything else is done for you!
$context['bbc_tags'] = array();
$context['bbc_tags'][] = array(
array(
'image' => 'bold',
'code' => 'b',
'before' => '[b]',
'after' => '[/b]',
'description' => $txt['bold'],
),
array(
'image' => 'italicize',
'code' => 'i',
'before' => '[i]',
'after' => '[/i]',
'description' => $txt['italic'],
),
array(
'image' => 'underline',
'code' => 'u',
'before' => '[u]',
'after' => '[/u]',
'description' => $txt['underline']
),
array(
'image' => 'strike',
'code' => 's',
'before' => '[s]',
'after' => '[/s]',
'description' => $txt['strike']
),
array(),
array(
'image' => 'pre',
'code' => 'pre',
'before' => '[pre]',
'after' => '[/pre]',
'description' => $txt['preformatted']
),
array(
'image' => 'left',
'code' => 'left',
'before' => '[left]',
'after' => '[/left]',
'description' => $txt['left_align']
),
array(
'image' => 'center',
'code' => 'center',
'before' => '[center]',
'after' => '[/center]',
'description' => $txt['center']
),
array(
'image' => 'right',
'code' => 'right',
'before' => '[right]',
'after' => '[/right]',
'description' => $txt['right_align']
),
);
$context['bbc_tags'][] = array(
array(
'image' => 'flash',
'code' => 'flash',
'before' => '[flash=200,200]',
'after' => '[/flash]',
'description' => $txt['flash']
),
array(
'image' => 'img',
'code' => 'img',
'before' => '[img]',
'after' => '[/img]',
'description' => $txt['image']
),
array(
'image' => 'url',
'code' => 'url',
'before' => '[url]',
'after' => '[/url]',
'description' => $txt['hyperlink']
),
array(
'image' => 'email',
'code' => 'email',
'before' => '[email]',
'after' => '[/email]',
'description' => $txt['insert_email']
),
array(
'image' => 'ftp',
'code' => 'ftp',
'before' => '[ftp]',
'after' => '[/ftp]',
'description' => $txt['ftp']
),
array(),
array(
'image' => 'glow',
'code' => 'glow',
'before' => '[glow=red,2,300]',
'after' => '[/glow]',
'description' => $txt['glow']
),
array(
'image' => 'shadow',
'code' => 'shadow',
'before' => '[shadow=red,left]',
'after' => '[/shadow]',
'description' => $txt['shadow']
),
array(
'image' => 'move',
'code' => 'move',
'before' => '[move]',
'after' => '[/move]',
'description' => $txt['marquee']
),
array(),
array(
'image' => 'sup',
'code' => 'sup',
'before' => '[sup]',
'after' => '[/sup]',
'description' => $txt['superscript']
),
array(
'image' => 'sub',
'code' => 'sub',
'before' => '[sub]',
'after' => '[/sub]',
'description' => $txt['subscript']
),
array(
'image' => 'tele',
'code' => 'tt',
'before' => '[tt]',
'after' => '[/tt]',
'description' => $txt['teletype']
),
array(),
array(
'image' => 'table',
'code' => 'table',
'before' => '[table]\n[tr]\n[td]',
'after' => '[/td]\n[/tr]\n[/table]',
'description' => $txt['table']
),
array(
'image' => 'code',
'code' => 'code',
'before' => '[c ode]',
'after' => '[/co de]',
'description' => $txt['bbc_code']
),
array(
'image' => 'quote',
'code' => 'quote',
'before' => '[quote]',
'after' => '[/quote]',
'description' => $txt['bbc_quote']
),
array(),
array(
'image' => 'list',
'code' => 'list',
'before' => '[list]\n[li]',
'after' => '[/li]\n[li][/li]\n[/list]',
'description' => $txt['list_unordered']
),
array(
'image' => 'orderlist',
'code' => 'orderlist',
'before' => '[list type=decimal]\n[li]',
'after' => '[/li]\n[li][/li]\n[/list]',
'description' => $txt['list_ordered']
),
array(
'image' => 'hr',
'code' => 'hr',
'before' => '[hr]',
'description' => $txt['horizontal_rule']
),
);


If you want to remove a button, remove the array(...) that lists it.

[edit] added spaces in code tag to not parse -Illori

Dwev

I was looking for a "true" that could be changed into "false", thanks guys, busy removing unneeded buttons right now.

I didn't remove the code though, just edited it out with double slahes (so if I ever would want to bring its back I don't have to look for the code).


//array(
// 'image' => 'center',
// 'code' => 'center',
// 'before' => '[center]',
// 'after' => '[/center]',
// 'description' => $txt['center']
//),

Arantor


Steve

Marking solved then. If you have any other questions regarding this topic, by all means, mark this unsolved and let us know. :)
DO NOT pm me for support!

Advertisement: