News:

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

Main Menu

Hide the BB Icons only, leave functionality intact.

Started by LeberMac, May 23, 2006, 10:35:37 AM

Previous topic - Next topic

LeberMac

OK, I am trying to modify the post box so that the formatting icons (bold, italic, glow, shadow, etc etc) are invisible to the general user, but are still available to the admin.

I don't want to DISABLE the options thru the admin control panel, I just want the interface to be less cluttered. Users will still be able to type in [b]Bold[/b] for Bold if they feel like typing out the code manually, but a simpler interface will be better for what I'm trying to accomplish.

I finally found where the code was to display the icons:

Line 742 of Post.template.php from 1.1 RC2 currrently looks like this:
if ($context['show_bbc'])
{ ... displays icons ... }


If I modify it to look like this:
if (($context['show_bbc']) && ($user_info['is_admin']))
{ ... displays icons ... }


Even admins can't see the line of code, then. (Although if I type it in manually it works just fine). I'm using 1.1 RC2 and Bloc's Amber theme (which I guess uses the default post.template.php). Are there any other aspects which I am missing here? (probably)

[EDIT]Oh, looks like I did it. I just needed to include $user_info as a global in the template_postbox function. So this works now. But there's probably something I missed, anyone have any suggestions on what else I should check? Is it bad to include $user_info as global?[/EDIT]
Tequila is proof that God loves us and wants us to be happy.

onijin

No.. It's not bad.

However I didn't add anything to the global.

I just changed your code from:

if (($context['show_bbc']) && ($user_info['is_admin']))

to:

if ($context['show_bbc'] && $context['user']['is_admin'])


Worked just fine.

Advertisement: