MyBB Community Forums

Full Version: If Usergroup
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hello i have 2 questions regarding to postbit
[Image: KUfbHyB.png]
As you can see on picture i selected 2 colors, Red - Question about how to do something like if usergroup id is 4 then show div

and blue one - How can i delete these "fake </br>" so there will be not much blank space between avatar, group icon and info 

if anyone can help in that case it will be awesome

Blue Color FIXED!
Look for the <br>s in postbit_classic template under postbit templates. They will be before {$post['groupimage']}
(2016-08-15, 02:28 PM)Ashley1 Wrote: [ -> ]Look for the <br>s in postbit_classic template under postbit templates. They will be before {$post['groupimage']}

Well there is no more <br> tags, thats why i named them "fake"
to use if statement you need a plugin to allow the use of php on templates:
http://mybbhacks.zingaburga.com/showthread.php?tid=260
ive done that with some side boxs and dropdown menus only viewable for certain groups
for ex this was a for a user side block with avatar on index template that its visible only to logged in users

<if !in_array($mybb->usergroup['gid'], array('1','5','7')) then>
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder1">
<tr>
<td class="thead1"><strong style="background-color: #C69A32;padding: 4px 11px 4px 14px;margin: -0.5%;color: #262626;"><i class="fa fa-user"></i> Welcome {$mybb->user['username']} </strong>
	</td>
</tr>
<tr>
<td class="trow3">
<span><img class="avat" src="{$mybb->user['avatar']}" alt="My Avatar" title="My Avatar"/></span>
	<span style="float: right;padding: 12px 35px 0px 0px;">
	<div class="ublock"><a href="search.php?action=finduserthreads&uid={$mybb->user['uid']}"><i class="fa fa-th-large"></i> &nbsp;My threads</a></br>
	<a href="search.php?action=finduser&uid={$mybb->user['uid']}"><i class="fa fa-comments"></i> &nbsp;My posts </a></br>
	<a href="{$mybb->settings['bburl']}/private.php" title="Private Messages"><span><i class="menu-icon fa fa-envelope"></i>&nbsp; Messages&nbsp;<b class="pmboxcount" style="float: none;">{$mybb->user['pms_unread']}</b></a></br>
	<li style="display: block;"><a href="{$mybb->settings['bburl']}/search.php?action=getnew" > <i class="fa fa-tags"></i>&nbsp; New Posts</a></li>
			<li style="display: block;"><a href="{$mybb->settings['bburl']}/search.php?action=getdaily"> <i class="fa fa-star"></i>&nbsp; Today´s Posts</a></li></div>
		</span>
</td>
</tr>
</table></br></if>

Wink
(2016-08-15, 06:43 PM)subzr1 Wrote: [ -> ]to use if statement you need a plugin to allow the use of php on templates:
http://mybbhacks.zingaburga.com/showthread.php?tid=260
ive done that with some side boxs and dropdown menus only viewable for certain groups
for ex this was a for a user side block with avatar on index template that its visible only to logged in users

<if !in_array($mybb->usergroup['gid'], array('1','5','7')) then>
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder1">
<tr>
<td class="thead1"><strong style="background-color: #C69A32;padding: 4px 11px 4px 14px;margin: -0.5%;color: #262626;"><i class="fa fa-user"></i> Welcome {$mybb->user['username']} </strong>
	</td>
</tr>
<tr>
<td class="trow3">
<span><img class="avat" src="{$mybb->user['avatar']}" alt="My Avatar" title="My Avatar"/></span>
	<span style="float: right;padding: 12px 35px 0px 0px;">
	<div class="ublock"><a href="search.php?action=finduserthreads&uid={$mybb->user['uid']}"><i class="fa fa-th-large"></i> &nbsp;My threads</a></br>
	<a href="search.php?action=finduser&uid={$mybb->user['uid']}"><i class="fa fa-comments"></i> &nbsp;My posts </a></br>
	<a href="{$mybb->settings['bburl']}/private.php" title="Private Messages"><span><i class="menu-icon fa fa-envelope"></i>&nbsp; Messages&nbsp;<b class="pmboxcount" style="float: none;">{$mybb->user['pms_unread']}</b></a></br>
	<li style="display: block;"><a href="{$mybb->settings['bburl']}/search.php?action=getnew" > <i class="fa fa-tags"></i>&nbsp; New Posts</a></li>
			<li style="display: block;"><a href="{$mybb->settings['bburl']}/search.php?action=getdaily"> <i class="fa fa-star"></i>&nbsp; Today´s Posts</a></li></div>
		</span>
</td>
</tr>
</table></br></if>

Wink
yeah i got this plugin But im talking about something like: If your group id is 4 above your avatar showing Text "Owner" And i dont know how to do it

refresh
ues the if statement twice.
one for groups below 4 and the second for groups above 4
create 2 css classes for each group also
eg:
<div id="bellow4">
<if !in_array($mybb->usergroup['gid'], array('1','5','7')) then>your code
</div>
<div id="above4">
<if !in_array($mybb->usergroup['gid'], array('3','4','6')) then> your code
</div>


the css for the divs:
#bellow4 {
display: none;}
#above4 {
display: block;}


it should be something like this

consider that this its just a ideia and it must be teaked but and a get start function Wink
the example i posted before it does work fine for me but never tried this way but the the ideia its the same so should work i guess
im not php guru or nothing
maybe some one off staff or coder could help more
good luck
naah it must be other way to do this;/