wysiwyg_custom toolbar buttons - admin user

3 posts by 2 authors in: Forums > CMS Builder
Last Post: January 2, 2017   (RSS)

Hi. I'd like to create a wysiwyg_custom.php that will allow one set of TinyMCE toolbar buttons for the admin user, and another set for all other user levels.

For example:

If user is 'admin', they will see these toolbar icons:
toolbar1: "formatselect fontsizeselect | bold italic underline | bullist numlist | charmap | removeformat fullscreen",
toolbar2: "forecolor backcolor | link | table | pastetext paste | code",
toolbar3: '',

All other user levels will see these:
toolbar1: "bold italic | bullist numlist | removeformat fullscreen",
toolbar2: '',
toolbar3: '',

If anyone can tell me how to accomplish this, it would make my world a much better place! :)

~ Deborah

By kitsguru - January 1, 2017

Near the top of your wysiwyg_custom.php you can test if the user is admin:

if (@$CMS_USER['isAdmin']) {
$toolbar1 ="formatselect fontsizeselect | bold italic underline | bullist numlist | charmap | removeformat fullscreen";
$toolbar2= "forecolor backcolor | link | table | pastetext paste | code";
} else [
$toolbar1 ="bold italic | bullist numlist | removeformat fullscreen";
$toolbar2= "";
}

then in the HTML portion you can set the toolbar(n) to the appropriate variables:

toolbar1: $toolbar1,
toolbar2: $toolbar2,

I haven't test it but that should be close.

Jeff Shields