MyBB Community Forums

Full Version: PHP in Templates and Template Conditionals
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
It could be this :

<elseif $post['usergroup] == "21" then>

It should be

<elseif $post['usergroup'] == "21" then>

You did not write the variable correctly. I think that is it.
It's a problem with this, if i want to use it:
<table border="0" cellspacing="1" cellpadding="4" class="tborder">
<thead>
<tr>
<td class="thead2" style="border-color: #ff6200;">
<strong>Servers</strong>
</td>
</tr>
</thead>
<tbody style="font-size:10px;">
<?php $servs = file_get_contents('http://xxx/asd.php'); echo $servs; ?>
</tbody>
</table>
</tbody>
</table>
And it's asd.php:
<?php ob_start(); include('s.php'); ?>
<tr>
<td class="trow1">Server #1<br />
<span style="color:green;"><?php echo $server; ?></span><br />
<span style="float:left;">Players: <?php echo $players.'/'.$playersmax; ?></span>
<span style="float:right;">Map: <?php echo $map;?></span><br />
<span style="float:left;"><a href="steam://connect/<?php echo $server; ?>">CONNECT</a></span>
<span style="float:right;"><?php echo $st; ?></span></td>
</tr>

It adds smth like this: http://scr.hu/0et9/kcygj . there's a blank area like <br />

This code works brilliant:
<table border="0" cellspacing="1" cellpadding="4" class="tborder" style="margin-top:10px;">
<thead>
<tr>
<td class="thead2" style="border-color: #ff6200;">
<strong>Strony/fora partnerskie</strong></td>
</tr>
</thead>
<tbody style="font-size:10px;">
<tr><td class="trow1">asd</td></tr>
</tbody></table>
screen: http://scr.hu/0et9/ep9ex
I'm trying to debug a if statement that doesn't shows a script (ads) only to 4 groups, to the other groups it should show normally.

I'm using the following:

Quote:<if !in_array($GLOBALS['mybb']->user['usergroup'], array(13,3,6,4)) then>
<script src="http://ads33751.hotwords.com.br/show.jsp?id=33751&cor=005F00"></script>
</if>

I happens that an user i gave the additional group 4 to it is still showing the ads (it has the script). I would like then to show the $GLOBALS['mybb']->user['usergroup'] at the page to be able to debug and see what is going on that my plan doesn't work.

How can I do that? And if someone would have some idea about what am I doing wrong that the script is showing for the group id 4 would be highly appreciated Wink
To include additional groups, try this:

<if !in_array($GLOBALS['mybb']->user['usergroup'], array(13,6,3,4)) && !in_array($GLOBALS['mybb']->user['additionalgroups'], array(13,6,3,4)) then>

Additional groups might need more work, but try if that works.
I found out now, I had to use the "additionalgroups" field of the user.
But the code below won't work when the user has more than one field, anyone could help me with that?

<if !in_array($GLOBALS['mybb']->user['usergroup'], array(13,3,6,4)) AND !in_array($GLOBALS['mybb']->user['additionalgroups'], array(13,3,6,4)) then>
<script src="http://ads33751.hotwords.com.br/show.jsp?id=33751&cor=005F00"></script>
</if>
Maybe this:
<if !array_intersect(array('X', 'Y', 'Z'), explode($mybb->user['additionalgroups'] ? $mybb->user['usergroup'].','.$mybb->user['additionalgroups'] : $mybb->user['usergroup'])) then>
<script src="http://ads33751.hotwords.com.br/show.jsp?id=33751&cor=005F00"></script>
</if>

X, Y, Z are the groups which are not supposed to see the ads.
Hi
I can't speak English well, I have a question :
can remove Private Messaging Completely in Configuration (For All user)
But
How To Remove Private Message Completely For one User-Group by use this method ?
i want ,not show private message panel in user controlpanel.
Thanks

Sorry, my English is very poor
^ use if condition in usercp_nav_messenger template (User Control Panel Templates)
you can put starting of the if condition at the top of usercp_nav_messenger and end it at the bottom (x is usergroup number)
<if $mybb->usergroup['gid'] != x then>
usercp_nav_messenger template code
</if>
(2013-05-24, 04:06 AM).m. Wrote: [ -> ]^ use if condition in usercp_nav_messenger template (User Control Panel Templates)
you can put starting of the if condition at the top of usercp_nav_messenger and end it at the bottom (x is usergroup number)
<if $mybb->usergroup['gid'] != x then>
usercp_nav_messenger template code
</if>

please more help

x=2
<if $mybb->usergroup['gid'] != 2 then>
usercp_nav_messenger template code ?
</if>
^ add <if $mybb->usergroup['gid'] != 2 then> at the top of usercp_nav_messenger template and add </if> at the end of the template.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22