MyBB Community Forums

Full Version: [SOLVED] get something to show to admin/mods only
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I would like this to only show to admins and mods...the post icon options, in reply and new thread editors.
There is generally only one way to implement conditions, other than making direct core code changes.

Install template conditionals plugin, then use something like

<if $GLOBALS['mybb']->user['usergroup'] >= 3 then>{$posticons}</if>

you will want to check the condition above, because banned group has the id=7 by default, but that gives you the idea.
Thanks...i didnt know about that option.
I installed that plugin, and edited the posticon template from


<tr>
<td class="trow1" style="vertical-align: top"><strong>{$lang->post_icon}</strong><span class="smalltext"><label class="posticons_label"><input type="radio" class="radio" name="icon" value="-1"{$no_icons_checked} />{$lang->no_post_icon}</label></span></td>
<td class="trow1" valign="top">{$iconlist}</td>
</tr>



to this
<tr>
<td class="trow1" style="vertical-align: top"><strong>{$lang->post_icon}</strong><span class="smalltext"><label class="posticons_label"><input type="radio" class="radio" name="icon" value="-1"{$no_icons_checked} />{$lang->no_post_icon}</label></span></td>
<td class="trow1" valign="top"><if $GLOBALS['mybb']->user['usergroup'] >= 3 then>{$iconlist}</if></td>
</tr>
but regular users can still see the post icon options


in your example you show a {variable} , but can you leave out html td tags too wtihin the if condition?

So i tried
<if $GLOBALS['mybb']->user['usergroup'] >= 3 then>
<tr>
<td class="trow1" style="vertical-align: top"><strong>{$lang->post_icon}</strong><span class="smalltext"><label class="posticons_label"><input type="radio" class="radio" name="icon" value="-1"{$no_icons_checked} />{$lang->no_post_icon}</label></span></td>
<td class="trow1" valign="top">{$iconlist}</td>
</tr>
	
</if>
but that still shows up as well
It should work as i gave it. you just need to find {$posticons} in the relevant templates and replace it with what i gave.

newreply_thread, newthread templates etc.
OK i replaced
{$posticons}

with
<if $GLOBALS['mybb']->user['usergroup'] >= 3 then>{$posticons}</if>

in both new threads and re reply templates.

But both admin and users can see post icons in when both reply and creating a new thread.
Erm...that's what you asked for ? Admin and mods to see only. Guests and regular users won't be able to see it.
Quote:Erm...that's what you asked for ? Admin and mods to see only. Guests and regular users won't be able to see it.
correct. I was jsut checking both accounts to see if either could not see if by any chance. 

I am also not worried about core edits. I have already made a ton of them.
(2016-09-30, 04:09 AM)metulburr Wrote: [ -> ]
Quote:Erm...that's what you asked for ? Admin and mods to see only. Guests and regular users won't be able to see it.
correct. I was jsut checking both accounts to see if either could not see if by any chance. 

I am also not worried about core edits. I have already made a ton of them.

No need for core edits, I have just tested this on my test forum, and it works perfectly.
hmm...

All i can think to do is to verify everything

here is my template conditional plugin activated. There is no settings available at all i see? No enable or disable options? All i see for this plugin is this. No other way to verify if it worked. 
[attachment=37503]

ACP -> Templates and STyle -> Templates -> {theme} (mine is default) -> New Reply TEmplates -> newreply
http://codepad.org/6Yc52ATN


and
ACP -> Templates and STyle -> Templates -> {theme} (mine is default) -> New Thread Templates -> newthread
http://codepad.org/2M8MqKRi

and after that i still get post icons showing in reply and new thread editors. 

EDIT:
I cant post the codepad here as i get blocked
This is what i have, logged in as a test user. Before the change

[Image: untitled.png]

After the change.

[Image: untitled2.png]
Pages: 1 2