MyBB Community Forums

Full Version: adding options for different user groups
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All
I am trying to solve the following problem :-
adding board functionality to different groups

The way I tackled this was to post the code I needed in the welcome_header_Block_admin template
<link type="text/css" href="/cometchat/cometchatcss.php" rel="stylesheet" charset="utf-8">
<script type="text/javascript" src="/cometchat/cometchatjs.php" charset="utf-8"></script>
followed by the normal welcome_header_block_admin code
this did not work (just for admin) I had to add the same code to welcome_header_block_member followed by the normal welcome_header_block_member code for it to work .... but this also opened up the code to a member as well. So is the answer to add some conditionals to test the users group & running the code on the result ? or have I gone around this the wrong way and there is a much easier solution ?
Regards Jim
You need to add that code to your headerinclude template, you can use template conditionals plugin to allow only administrators to load the code.
(2011-08-03, 09:11 PM)Sama34 Wrote: [ -> ]You need to add that code to your headerinclude template, you can use template conditionals plugin to allow only administrators to load the code.
I guess that means the conditionals are added to header include and not the welcome_block templates

(2011-08-03, 09:11 PM)Sama34 Wrote: [ -> ]You need to add that code to your headerinclude template, you can use template conditionals plugin to allow only administrators to load the code.

This did not work .. just stopped the board from loading
<if $mybb->user['Gid']==4 then>
<link type="text/css" href="/cometchat/cometchatcss.php" rel="stylesheet" charset="utf-8">
<script type="text/javascript" src="/cometchat/cometchatjs.php" charset="utf-8"></script></if>
<if $mybb->usergroup['gid'] == 4 then>
<link type="text/css" href="/cometchat/cometchatcss.php" rel="stylesheet" charset="utf-8">
<script type="text/javascript" src="/cometchat/cometchatjs.php" charset="utf-8"></script></if> 

And you need this plugin for it to work:
http://mybbhacks.zingaburga.com/showthread.php?tid=464
(2011-08-04, 07:16 PM)Sama34 Wrote: [ -> ]
<if $mybb->usergroup['gid'] == 4 then>
<link type="text/css" href="/cometchat/cometchatcss.php" rel="stylesheet" charset="utf-8">
<script type="text/javascript" src="/cometchat/cometchatjs.php" charset="utf-8"></script></if> 

And you need this plugin for it to work:
http://mybbhacks.zingaburga.com/showthread.php?tid=464

got the plugin I have used conditionals all over the place fyi what actaully worked was a protracted if .. elseif statement like
<if $GLOBALS['mybb']->user['usergroup'] == 4 then>
<link type="text/css" href="/cometchat/cometchatcss.php" rel="stylesheet" charset="utf-8">
<script type="text/javascript" src="/cometchat/cometchatjs.php" charset="utf-8"></script>
<elseif  $GLOBALS['mybb']->user['usergroup'] == 6 then>
<link type="text/css" href="/cometchat/cometchatcss.php" rel="stylesheet" charset="utf-8">
<script type="text/javascript" src="/cometchat/cometchatjs.php" charset="utf-8"></script>
</if>
this worked but added the executable code to pop up windows (buddy list ip check etc ) where as the desired result was to add the code to the main board windows and not the pop ups so rather than header include which template should the code live in ?
Sorry, I don't understand what you just said, do you want more that one group to use the chat?
dont put that template edit in headerinclude. put it individually in

index, forumdisplay, showthread, newreply, newthread, memberlist, and others you want. Those templates have <head> sections that you can add the code below the {$headerinclude} template variable
(2011-08-04, 10:19 PM)Sama34 Wrote: [ -> ]Sorry, I don't understand what you just said, do you want more that one group to use the chat?
yes but not all groups

(2011-08-04, 11:03 PM)pavemen Wrote: [ -> ]dont put that template edit in headerinclude. put it individually in

index, forumdisplay, showthread, newreply, newthread, memberlist, and others you want. Those templates have <head> sections that you can add the code below the {$headerinclude} template variable

good call ... a bit more work to remember which templates to add the code to ...but what happens with a plugin without a template?? ... edit the plugin ?
(2011-08-05, 05:12 PM)JimR Wrote: [ -> ]good call ... a bit more work to remember which templates to add the code to ...but what happens with a plugin without a template?? ... edit the plugin ?

most plugins either have their own templates or simply modify existing ones, otherwise they are not impacting the suers display and thus don't need the JS file you want to add.
<if in_array($GLOBALS['mybb']->user['usergroup'], array(4,6,3)) then>
<link type="text/css" href="/cometchat/cometchatcss.php" rel="stylesheet" charset="utf-8">
<script type="text/javascript" src="/cometchat/cometchatjs.php" charset="utf-8"></script></if> 

Try this one.