MyBB Community Forums
[How To?] Make conditional codes? - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: 1.8 Support (https://community.mybb.com/forum-175.html)
+--- Forum: General Support (https://community.mybb.com/forum-176.html)
+--- Thread: [How To?] Make conditional codes? (/thread-179329.html)



Make conditional codes? - waraikobuot - 2015-09-17

please check this code

<if $mybb->user['usergroup'] == 1 then>
					    <h1 class="welcomeBlockHeader">Welcome to Our Community</h1>
						<p class="welcomeBlockMessage">Wanting to join the rest of our members? Feel free to sign up today.</p>
					    <p><a href="{$mybb->settings['bburl']}/member.php?action=register" class="sign_up_header">Sign up</a></p>
						<else>
						<img src="{$mybb->user['avatar']}" class="avatar-defaut hidden-xs" alt="#" style="float: left; width: 40px; height: 40px; margin-right: 10px; background: transparent;" /><h1 class="welcomeBlockHeader">Welcome back, {$mybb->user['username']}</h1>
							<p class="welcomeBlockMessage"><span class="label label_red">{$mybb->user['postnum']}</span> Posts - <span class="label label_red">{$mybb->user['threadnum']}</span> Threads - <span class="label label_red">{$mybb->user['totalpms']}</span> Messages - <span class="label label_red">{$mybb->user['reputation']}</span> Reputation</p>
					    <p><a href="{$mybb->settings['bburl']}/member.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}" class="sign_up_header">{$lang->welcome_logout}</a></p>
						</if>



RE: Make conditional codes? - .m. - 2015-09-17

where you want to use such conditions ? you can use template conditionals plugin for such requirements.

however, similar information is already available in default MyBB system. no need of conditional codes.

header_welcomeblock_member template is used for guests group specific information
and header_welcomeblock_member template is used for members group specific information.