possible to limit "New Posts" in navbar to certain usergroups?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GearTripper
    Senior Member
    • Aug 2004
    • 440

    possible to limit "New Posts" in navbar to certain usergroups?

    i would like the navbar "New Posts" to only appear for certain usergroups, rather then 'members'... is this possible? basically, i have the themplate mod that shows total new posts with a number, which includes posts from the administration sections. a lot of users don't have access to this section for moderators only, so when they click on the navbar new posts and expect to see all these new posts - it only shows for example, 10 new posts instead of the navbar number which may show around 20.

    Edited to fix my english.
    Last edited by GearTripper; Fri 30 Sep '05, 3:43pm.
  • Jake Bunce
    Senior Member
    • Dec 2000
    • 46598
    • 3.6.x

    #2
    Admin CP -> Styles & Templates -> Style Manager -> « » -> Navigation / Breadcrumb Templates -> navbar

    Add the red code:

    Code:
    			[color=red]<if condition="in_array($bbuserinfo[usergroupid], array(X,Y,Z))">[/color]
    				<td class="vbmenu_control"><a href="search.php?$session[sessionurl]do=getnew" accesskey="2">$vbphrase[new_posts_nav]</a></td>
    			[color=red]</if>[/color]
    Where X,Y,Z is a comma list of primary usergroupids for which the link will show.

    There should be 3 instances of this code in that template.

    Comment

    • hdd3md
      New Member
      • Feb 2005
      • 21
      • 3.0.7

      #3
      what about secondary user groups

      ie group id>7. i have a usergroup id 9 which is not working...

      PHP Code:
      <if condition="in_array($bbuserinfo[usergroupid],array(9,5,6,7))"

      doesn't work for usergroupid 9

      Comment

      • Lats
        Senior Member
        • Mar 2002
        • 3671

        #4
        Additional usergroups are harder to check as they are handled a bit differently. This works if they are a member of 1 additional usergroup, or the number you are checking appears first in the field.
        Code:
        <if condition="in_array($bbuserinfo[usergroupid], array(X,Y,Z)) OR in_array($bbuserinfo[membergroupids], array(J,K,L))">
        Lats...

        Comment

        • hdd3md
          New Member
          • Feb 2005
          • 21
          • 3.0.7

          #5
          lats, thank you.

          do you know the equivalent expression for secondary groups in php?

          i want to check if the user belongs to group 9. my expression only works for the primary user groups for me..

          Comment

          • Lats
            Senior Member
            • Mar 2002
            • 3671

            #6
            Err, just change either J,K or L above to a 9 - that will pick them up.
            Lats...

            Comment

            • Jake Bunce
              Senior Member
              • Dec 2000
              • 46598
              • 3.6.x

              #7
              That shouldn't work with secondary groups. You have to call is_member_of() for each group:

              Code:
              <if condition="is_member_of($bbuserinfo, [color=red]X[/color]) OR is_member_of($bbuserinfo, [color=red]Y[/color]) OR is_member_of($bbuserinfo, [color=red]Z[/color])">
              Where X, Y, and Z are usergroupids of secondary groups.

              Comment

              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
              Working...