SMF Support > SMF 2.0.x Support
BBC Code button only for some membergroup?
(1/1)
edi67:
How i could create one BBC code button visible only for certain membergroup?
thx
ccbtimewiz:
Just the button or the function itself?
edi67:
--- Quote from: ccbtimewiz on October 23, 2008, 03:09:09 PM ---Just the button or the function itself?
--- End quote ---
Well just button for now, the function already exist but is hidden for all
is possible to have the function too only for certain usergroup?
ディン1031:
First search in Subs-Editor.php for
--- Code: --- 'hr' => array('code' => 'hr', 'before' => '[hr]', 'description' => $txt['horizontal_rule']),
);
--- End code ---
add after
--- Code: --- //Okay now Add some Custom Group related buttons ;D
global $user_info;
// Show the toggle?
if ($user_info['is_admin'] || in_array(2, $user_info['groups']))
{
$context['bbc_tags'][1][] = array();
$context['bbc_tags'][1]['mycodename'] = array('code' => 'tt', 'before' => '[tt]', 'after' => '[/tt]', 'description' => $txt['teletype']);
}
--- End code ---
This add to the second line add the end a small space an this new button (Before the remover and the the toggle button)
each line
--- Code: --- $context['bbc_tags'][1]['mycodename'] = array('code' => 'tt', 'before' => '[tt]', 'after' => '[/tt]', 'description' => $txt['teletype']);
--- End code ---
is a new button.
Short description:
The mycodename will be the image name mycodename.gif. That file need to be stored into the bbc folder of the default theme image folder or the current theme image folder depend on the theme ;).
--- Code: ---'code' => 'tt',
--- End code ---
This is the name of the bbc.
--- Code: ---'before' => '[tt]',
--- End code ---
this is the name of the start tag
--- Code: ---'after' => '[/tt]',
--- End code ---
this is the name of the end tag, if you only need start tag don't insert that.
If you mark something in the post the before and after will be put before and after the select.
--- Code: ---'description' => $txt['teletype']
--- End code ---
That what is say a description, you can use string here if you don't like to create the $txt string :x.
Bye
DIN1031
edi67:
Hey DIN you know that i appreace a lot your time spent with me ;) thx very much your help work perfectly :) great DIN
Navigation
[0] Message Index
Go to full version