Announcement

Collapse
No announcement yet.

Displaying forum post counts but not allowing access

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

  • Displaying forum post counts but not allowing access

    Folks,

    I'm a bit stuck, i'd like for everyone, (including unreg'd / not logged in) users to be able to see the post / thread counts from the forum index, but not be able to view the forum's posts.

    In my user permissions i've got everything set to no, apart from under the forum viewing permissions "Can view forum" is set to yes.

    This is okay, users can see the forums from the index, but can't see post counts. Which negates the point of trying to tease the users

    Has anyone got any suggestions on how i can allow users to see post counts for a forum, but not actually see or read threads / posts in the restricted forum?

    Many thanks in advance

  • #2
    This can be done by modifying the files or adding an extra query in the phpinclude_start template. For help with modifying the files I recommend you post on www.vbulletin.org , otherwise try this:

    Go to your:

    Admin CP -> Styles & Templates -> Style Manager -> « » -> PHP Include Code Templates -> phpinclude_start

    Add this code:

    PHP Code:
    // IF FORUMHOME OR FORUMDISPLAY PAGE
    if (THIS_SCRIPT == 'index' OR THIS_SCRIPT == 'forumdisplay')
    {
        
    // GET FORUM COUNTERS
        
    $forumcounts$DB_site->query("SELECT forumid, replycount, threadcount
            FROM " 
    TABLE_PREFIX "forum
            "
    );

        
    // SET VALUES
        
    while ($forumcount $DB_site->fetch_array($forumcounts))
        {
            
    $forumreply[$forumcount[forumid]] = $forumcount[replycount];
            
    $forumthread[$forumcount[forumid]] = $forumcount[threadcount];
        }

    Then go to your:

    Admin CP -> Styles & Templates -> Style Manager -> « » -> Forum Home Templates

    Replace $forum[threadcount] and $forum[replycount] with {$GLOBALS[forumthread][$forum[forumid]]} and {$GLOBALS[forumreply][$forum[forumid]]} in the forumhome_forumbit_level1_post and forumhome_forumbit_level2_post templates.

    That should work for you.
    Last edited by Jake Bunce; Fri 14 May '04, 9:57pm.

    Comment


    • #3
      Can aslo be done with a template conditional

      Comment


      • #4
        Originally posted by Zachery
        Can aslo be done with a template conditional
        How?

        Comment


        • #5
          In postbit(_legacy) template you need to find

          HTML Code:
          $post[message]
          and replace it with

          HTML Code:
          <if condition="$bbuserinfo[userid] != 0"> $post[message] <else /> Please register to be able to view our sites content </if>
          And find in the threadbit template

          HTML Code:
          <td class="alt1Active" id="t$thread[threadid]" title="$thread[preview]">
          and replace with

          HTML Code:
          <td class="alt1Active" id="t$thread[threadid]" <if condition="$bbuserinfo[userid] != 0">title="$thread[preview]"</if>>

          Restore the regular options and users will be able to see counts but not post content.

          Comment


          • #6
            Ah, basically putting permissions in the style instead of the permission system. Just be sure this change is in every style.

            Comment


            • #7
              Folks, many thanks for your help i have tried both solutions, and with the first, i got a {Number where the thread count should of been, second one, didnt work flat out right.

              Comment


              • #8
                How did the second not work right out? O.o im using it on a few of my own forums.,

                Comment


                • #9
                  And I tested my solution before posting it. It worked.

                  If you send me a private message with a URL and admin login for your forums then I can take a look at why my solution isn't working.

                  Comment


                  • #10
                    I followed the instructions....


                    Will PM you, cheers

                    Comment


                    • #11
                      Zachary, what your option does is a little different than what I think the user was looking for (or at least what I was looking for which I think is the same thing he was).

                      Yours allows the user to see ALL threads and the first post of the thread but to read any responses it requires them be registered.

                      What I was looking for (and I think what the original poster was looking for) is an option that on the Forum Home page instead of showing "Last Post" as "Never", would show the thread title and info for the last post, then when they attempt to access the forum they are required to register.
                      Julie

                      Comment


                      • #12
                        Jake, yours almost works. It does show an actual number (instead of 0) for the number of posts and threads in the forum but it still shows "Never" where the Last Post info should be.
                        Julie

                        Comment


                        • #13
                          That's somewhat similar to what i needed, but i only wanted users from a certain usergroup to be able to read threads. Regular users and Unreg'd should only be able to see thread / post counts, nothing else

                          Comment


                          • #14
                            Originally posted by JustAskJulie
                            Jake, yours almost works. It does show an actual number (instead of 0) for the number of posts and threads in the forum but it still shows "Never" where the Last Post info should be.
                            Ya, this was only designed to work for reply / thread counts.

                            I am whipping up some code for the last post right now.

                            Comment


                            • #15
                              Originally posted by Jake Bunce
                              This can be done by modifying the files or adding an extra query in the phpinclude_start template. For help with modifying the files I recommend you post on www.vbulletin.org , otherwise try this:

                              Go to your:

                              Admin CP -> Styles & Templates -> Style Manager -> « » -> PHP Include Code Templates -> phpinclude_start

                              Add this code:

                              PHP Code:
                              // IF FORUMHOME OR FORUMDISPLAY PAGE
                              if (THIS_SCRIPT == 'index' OR THIS_SCRIPT == 'forumdisplay')
                              {
                                  
                              // GET FORUM COUNTERS
                                  
                              $forumcounts$DB_site->query("SELECT forumid, replycount, threadcount
                                      FROM " 
                              TABLE_PREFIX "forum
                                      "
                              );

                                  
                              // SET VALUES
                                  
                              while ($forumcount $DB_site->fetch_array($forumcounts))
                                  {
                                      
                              $forumreply[$forumcount[forumid]] = $forumcount[replycount];
                                      
                              $forumthread[$forumcount[forumid]] = $forumcount[threadcount];
                                  }

                              Then go to your:

                              Admin CP -> Styles & Templates -> Style Manager -> « » -> Forum Home Templates

                              Replace $forum[threadcount] and $forum[replycount] with {$GLOBALS[forumthread][$forum[forumid]]} and {$GLOBALS[forumreply][$forum[forumid]]} in the forumhome_forumbit_level1_post and forumhome_forumbit_level2_post templates.

                              That should work for you.
                              Actually, I just tried this and it didn't work for me at all. I followed all the instruction carefully, and now the index page shows nothing (it doesn't show counted threads/post, neither does say "never". It's just blank (the "threads/post", while the "last post" states "never"?

                              I should also mention that in my forum permissions/and unregistered usergroups permissions I have, show forum > YES + show threads > NO.

                              If I change to show threads to > YES, the treads can be seen without being prompted to register.

                              Grrrrr...

                              Comment

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