Announcement

Collapse
No announcement yet.

Hide Thread & Post Count with If Statement

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hide Thread & Post Count with If Statement

    Hi,
    I would like to be able to hide my thread and post count from certain usergroups . Infact I only want moderators and admins to be able to see the counts in the forum display . I want it to look like http://www.webforumz.com/subscriber-only-forums/

    I believe I have to edit the forumhome_forumbit_level2_post
    What do I edit . I have included my forumhome_forumbit_level2_post

    Or is there a way to hide the threads and the posts columns from certain usergroups . I looked thru the vb manual and I cant figure it out . Thanks

    PHP Code:
    <tr align="center">
    <
    td class="alt2"><img src="$stylevar[imgdir_statusicon]/forum_$forum[statusicon].gif" alt="" border="0" /></td>
    <
    td class="alt1Active" align="$stylevar[left]id="f$forum[forumid]">
    <
    div>
    <
    a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]"><strong>$forum[title]</strong></a>
    <if 
    condition="$show['browsers']"><span class="smallfont">(<phrase 1="$forum[browsers]">$vbphrase[x_viewing]</phrase>)</span></if>
    </
    div>
    <if 
    condition="$show['forumdescription']"><div class="smallfont">$forum[description]</div></if>
    <if 
    condition="$show['forumsubscription']"><div class="smallfont"><strong><a href="subscription.php?$session[sessionurl]do=removesubscription&amp;f=$forum[forumid]rel="nofollow">$vbphrase[unsubscribe_from_this_forum]</a></strong></div></if>
    <if 
    condition="$show['subforums']"><div class="smallfont" style="margin-top:$stylevar[cellpadding]px"><strong>$vbphrase[subforums]</strong>: $forum[subforums]</div></if>
    </
    td>
    <
    td class="alt2" nowrap="nowrap">$forum[lastpostinfo]</td>
    <
    td class="alt1">$forum[threadcount]</td>
    <
    td class="alt2">$forum[replycount]</td>
    <if 
    condition="$vboptions['showmoderatorcolumn']">
    <
    td class="alt1"><div class="smallfont">$forum[moderators]&nbsp;</div></td>
    </if>
    </
    tr>
    $childforumbits 

  • #2
    The "private" option is here:

    Admin CP -> vBulletin Options -> Forums Listings Display Options -> Show Private Forums

    Comment


    • #3
      I have that set to No already but if you look at this link under the thread column and the post column . It says private . Mine shows me private under the last post but I want to make the thread count and post count private too . Thanks

      Comment


      • #4
        You can use a condition like this:

        Code:
        <if condition="is_member_of($bbuserinfo, X, Y, Z)">Private<else />$forum[threadcount]</if>
        Where X, Y, Z is a comma list of usergroupids that will see "Private."

        Comment


        • #5
          I can't get the if statement to work . I must be doing something wrong .
          I have tried the 3 statements below .

          PHP Code:
          <if condition="is_member_of($bbuserinfo[usergroupid], 1, 2, 3,4)">Private<else />$forum[threadcount]</if>
           
          <if 
          condition="!is_member_of($bbuserinfo[usergroupid],1,2,3,4)">Private<else />$forum[threadcount]</if>
           
          <if 
          condition="is_member_of($bbuserinfo, 01, 02, 03, 04)">Private<else />$forum[threadcount]</if> 

          </DIV>

          Comment


          • #6
            Only change the red part. Don't use leading zeros in the numbers.

            Comment


            • #7
              I used this statement and I have put it in the code towards the bottom but I still see the thread and post count . Maybe I am not inserting the code in the right place .

              PHP Code:
              <if condition="is_member_of($bbuserinfo, 1, 2, 3, 4)">Private<else />$forum[threadcount]</if> 
              PHP Code:
              <tr align="center">
              <
              td class="alt2"><img src="$stylevar[imgdir_statusicon]/forum_$forum[statusicon].gif" alt="" border="0" /></td>
              <
              td class="alt1Active" align="$stylevar[left]id="f$forum[forumid]">
              <
              div>
              <
              a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]"><strong>$forum[title]</strong></a>
              <if 
              condition="$show['browsers']"><span class="smallfont">(<phrase 1="$forum[browsers]">$vbphrase[x_viewing]</phrase>)</span></if>
              </
              div>
              <if 
              condition="$show['forumdescription']"><div class="smallfont">$forum[description]</div></if>
              <if 
              condition="$show['forumsubscription']"><div class="smallfont"><strong><a href="subscription.php?$session[sessionurl]do=removesubscription&amp;f=$forum[forumid]rel="nofollow">$vbphrase[unsubscribe_from_this_forum]</a></strong></div></if>
              <if 
              condition="$show['subforums']"><div class="smallfont" style="margin-top:$stylevar[cellpadding]px"><strong>$vbphrase[subforums]</strong>: $forum[subforums]</div></if>
              </
              td>
              <
              td class="alt2" nowrap="nowrap">$forum[lastpostinfo]</td>
              <
              td class="alt1">$forum[threadcount]</td>
              <
              td class="alt2">$forum[replycount]</td>
              <if 
              condition="$vboptions['showmoderatorcolumn']">
              <if 
              condition="is_member_of($bbuserinfo, 1, 2, 3, 4)">Private<else />$forum[threadcount]</if>
              <
              td class="alt1"><div class="smallfont">$forum[moderators]&nbsp;</div></td>
              </if>
              </
              tr>
              $childforumbits 

              Comment


              • #8
                In the context of the template code, add the colored code:

                Code:
                <td class="alt2" nowrap="nowrap">$forum[lastpostinfo]</td>
                <td class="alt1"><if condition="is_member_of($bbuserinfo, X, Y, Z)">Private<else />$forum[threadcount]</if></td>
                <td class="alt2">$forum[replycount]</td>

                Comment


                • #9
                  Thanks for helping me so much but I still cant get this to work . I have the code like below . It looks like it should work but its not .

                  PHP Code:
                  <td class="alt2" nowrap="nowrap">$forum[lastpostinfo]</td>
                  <
                  td class="alt1"><if condition="is_member_of($bbuserinfo, 1,2,3,4 )">Private<else />$forum[threadcount]</if></td>
                  <
                  td class="alt2">$forum[replycount]</td>
                  <if 
                  condition="$vboptions['showmoderatorcolumn']">
                  <
                  td class="alt1"><div class="smallfont">$forum[moderators]&nbsp;</div></td

                  Comment


                  • #10
                    What is the URL to your forum?

                    Comment


                    • #11
                      Jake Thank You very much for going the extra lenght . I know you didn't even have to bother with this template mod .

                      I just figured out my problem and I got it working

                      I had to change 2 templates

                      forumhome_forumbit_level1_post &
                      forumhome_forumbit_level2_post

                      with

                      Code:
                      <td class="alt1"><if condition="is_member_of($bbuserinfo, 1,2,3,4 )">Private<else />$forum[threadcount]</if></td>
                      <td class="alt2""><if condition="is_member_of($bbuserinfo, 1,2,3,4 )">Private<else />$forum[replycount]</if></td>

                      Comment

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