Announcement

Collapse
No announcement yet.

Rating for each message...

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

  • Rating for each message...

    Would it be possible to display the thread rating from each poster?

    Also, could I restrict thread rating to ones who reply?

  • #2
    Both of these would require custom hacks. Good ideas though, especially the second one.

    Comment


    • #3
      Re: Rating for each message...

      Originally posted by usbnuts
      Also, could I restrict thread rating to ones who reply?
      In threadrate.php, replace this:
      Code:
         } else {
            $DB_site->query("INSERT INTO threadrate (threadid,userid,vote)
                             VALUES ('$threadid','$bbuserinfo[userid]','$vote')");
      with
      Code:
         } elseif (!$DB_site->query_first("SELECT postid FROM post WHERE userid = $bbuserinfo[userid] AND threadid = '$threadid'")) {
           eval("standarderror(\"".gettemplate("templatenamehere")."\");");
           exit;
         } else {
            $DB_site->query("INSERT INTO threadrate (threadid,userid,vote)
                             VALUES ('$threadid','$bbuserinfo[userid]','$vote')");
      I think that should do what you want.

      Edit:
      This won't work for guest (so they can rate threads even if they have yet to post in it).
      I'll try to solve that.
      Last edited by Chen; Sun 9 Sep '01, 1:53am.
      Chen Avinadav
      Better to remain silent and be thought a fool than to speak out and remove all doubt.

      גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

      Comment


      • #4
        FireFly, thank you.

        However, to vBulletin Developers, I studied the structure of some key tables. I discovered that vBulletin calcaulates the average of the rating realtime from the total value of ratings and number of posts. The program doesn't store individual rating.

        I suppose it will take considerable amount of hacking for my idea to materialize.

        Comment


        • #5
          Actually it does - in a table named threadrate.

          Bascially, to make the rate show up in the postbit template, you'd need to add something like this in the getpostbit function:
          PHP Code:
          $rated=$DB_site->query("SELECT vote FROM threadrate WHERE userid='$post[userid]' AND threadid='$threadid'"); 
          and then you could use $rated[vote] in your postbit template. I think.
          Last edited by Chen; Sun 9 Sep '01, 9:52am.
          Chen Avinadav
          Better to remain silent and be thought a fool than to speak out and remove all doubt.

          גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

          Comment


          • #6
            Re: Re: Rating for each message...

            Originally posted by FireFly
            This won't work for guest (so they can rate threads even if they have yet to post in it).
            I was reading the User Guide... can't the admin set it so that only certain groups can rate threads?
            "Twenty years from now you'll be more disappointed by the things you didn't do than by the ones you did."
            - Mark Twain

            Comment


            • #7
              Yeah the admin can do that, but what I meant was that the code I added (to prevent users from rating a thread without posting in it) will now work on guests.
              So if you DO let guests rate threads, this won't stop them.
              Chen Avinadav
              Better to remain silent and be thought a fool than to speak out and remove all doubt.

              גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

              Comment


              • #8
                Originally posted by FireFly
                Actually it does - in a table named threadrate.

                Bascially, to make the rate show up in the postbit template, you'd need to add something like this in the getpostbit function:
                PHP Code:
                $rated=$DB_site->query("SELECT vote FROM threadrate WHERE userid='$post[userid]' AND threadid='$threadid'"); 
                and then you could use $rated[vote] in your postbit template. I think.
                Where can I find "getpostbit" function?
                I can locate postbit inside TEMPLATE, but not getpostbit.

                Thanks!

                Comment


                • #9
                  getpostbit() is in admin/functions.php.

                  Comment


                  • #10
                    Oh okay. So I have to edit the PHP programs not the template.

                    Thanks!

                    I will let you guys know the result.

                    BTW, if this mini-hack works, I guess any upgrades will overwrite this file, right?

                    Comment


                    • #11
                      Originally posted by usbnuts
                      BTW, if this mini-hack works, I guess any upgrades will overwrite this file, right?
                      Yep, that's why I don't do many hacks.
                      Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
                      Change CKEditor Colors to Match Style (for 4.1.4 and above)

                      Steve Machol Photography


                      Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


                      Comment


                      • #12
                        Sorry to bother you guys again...but where do I put the line under the post

                        PHP Code:
                        $rated=$DB_site->query("SELECT vote FROM threadrate WHERE userid='$post[userid]' AND threadid='$threadid'"); 
                        I put this line right under

                        PHP Code:
                        // ###################### Start buildpostbit #######################
                        function getpostbit($post) {
                        // sorts through all the stuff to return the postbit template 
                        It doesn't work.

                        Error code:
                        Fatal error: Call to a member function on a non-object in /forums/admin/functions.php on line 56

                        Comment


                        • #13
                          http://www.vbulletin.com/forum/showt...threadid=27808

                          Comment


                          • #14
                            Wow you're on fire lately.

                            (pssst, add it to your sig )
                            Chen Avinadav
                            Better to remain silent and be thought a fool than to speak out and remove all doubt.

                            גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

                            Comment


                            • #15
                              It's funny you should say that - I just redid my sig.

                              Comment

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