1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Post Ratings - taking likes to the next level [Paid] 1.7.5

Powerful replacement for Likes — adds ability to rate posts (e.g. Dislike, Friendly, Funny, Dumb)

  1. Luke F

    Luke F Well-Known Member

    DBTech Adv. Post Thanks/Like import:

    Code:
    insert ignore into XENFORO_DB_NAME.dark_postrating select null, contentid, userid, receiveduserid, if(varname = 'thanks', THANKS_RATING_ID, if(varname = 'dislike', DISLIKE_RATING_ID, 1)), dateline from VBULLETIN_DB_NAME.dbtech_thanks_entry

    ___________________________________________________________



    Post Thank You Hack import:

    Code:
    insert ignore into XENFORO_DB_NAME.dark_postrating select null, postid, userid, content_userid, THANKS_RATING_ID, date from VBULLETIN_DB_NAME.post_thanks
    For both queries you must import keeping source IDs and replace the bits in caps with the relevant values. Once done, run Recount Ratings in your Admin CP.



    Alternative Post Thank You hack import for where your table does not contain content_userid:

    Code:
    insert ignore into XENFORO_DB_NAME.dark_postrating select null, postid, userid, null, THANKS_RATING_ID, date from VBULLETIN_DB_NAME.post_thanks
    Code:
    update dark_postrating r set r.rated_user_id = (select p.user_id from xf_post p where p.post_id = r.post_id) where r.rated_user_id is null


    ___________________________________________________________


    Delete all ratings made by a user:

    Code:
    delete from dark_postrating where user_id = x
    (Then run recount ratings.)

    ___________________________________________________________


    Delete all ratings received by a user (aka reset a user's rating scores):

    Code:
    delete from dark_postrating where rated_user_id = x
    (Then run recount ratings.)

    ___________________________________________________________


    Delete all negative ratings made by a user:

    Code:
    delete pr
    from dark_postrating pr
    left join dark_postrating_ratings r on pr.rating = r.id
    where pr.user_id = x and r.type = -1
    (Then run recount ratings.)

    ___________________________________________________________


    Delete all negative ratings received by a user:

    Code:
    delete pr
    from dark_postrating pr
    left join dark_postrating_ratings r on pr.rating = r.id
    where pr.rated_user_id = x and r.type = -1
    (Then run recount ratings.)


    ___________________________________________________________


    XenPorta 2 support:




    ___________________________________________________________


    Convert like format: (not recommended)

    http://xenforo.com/community/thread...the-next-level-paid.28475/page-23#post-344980




    ___________________________________________________________


    Convert ratings to likes: (irreversible; for permanent uninstallations)


    1. Select a rating you would like to convert to XF Likes in Options > Post Ratings > Like rating
    2. Run Recount Ratings
    3. Click cancel once it starts building the rating cache
    4. Repeat steps 1-3 for all ratings you would like to convert to likes


    ___________________________________________________________


    Recounting ratings on extremely large databases (aka if 'recount ratings' in ACP times out):

    1. Follow instructions above to convert like format
    2. http://xenforo.com/community/thread...the-next-level-paid.28475/page-85#post-629004

    No longer needed as of version 1.7.0

    ___________________________________________________________


    Font Awesome rating icons (experimental, no support provided):

    Update: An alternative user-provided solution is available here: https://xenforo.com/community/threa...he-next-level-paid.28475/page-130#post-926118

    Add to EXTRA.css:

    Code:
    .dark_postrating_textonly { font-family: FontAwesome; font-size: 1.6em; vertical-align: bottom; }
    Add a new rating, leaving 'Icon' blank and set 'Title' to the raw unicode character for the desired Font Awesome icon. This can be copy+pasted via inspect element in your web browser: [​IMG]

    Note that having an actual title along with the icon is not possible without template modifications. (You could put the name next to the unicode symbol, but it won't have the same rollover caption.)


    ___________________________________________________________


    Anonymous ratings:

    To make all ratings on your forum anonymous, simply deny the 'list ratings' permission, and edit the templates news_feed_item_postrating_rate and alert_postrating_rate, changing all instances of:

    Code:
           'name={xen:helper username, $user, 'primaryText'}',
    To something like:

    Code:
           'name=A user',
     
    Last edited: Jul 17, 2016
    Robinxd, Corwin, Deriel and 55 others like this.
  2. Luke F

    Luke F Well-Known Member

    Manual Template Edits:


    These template edits are for legacy versions (Post Ratings 1.5.1 and below) ONLY.


    Apply this edit to XenForo versions 1.1.2 and 1.1.3 only:
    (And any older versions but note that they are not supported anyway)

    • Add this code to the start of the ad_message_below template:
      <xen:hook name="message_below" params="{xen:array 'post={$message}','message_id={$messageId}'}" />

    Additionally, apply these edits to versions 1.1.2 - 1.1.5:

    • In member_list_item, (Do not save between these two edits to this template)
      Before: <div class="userInfo">
      Add : <xen:hook name="dark_member_list_info" params="{xen:array 'user={$user}'}">
    • Also in member_list_item,
      Before: <xen:else />
      Add: </xen:hook>
    • (Optional) If you have XenPorta installed, in EWRporta_ArticleMessage,
      Before the final: </li>
      Add: <xen:hook name="message_below" params="{xen:array 'post={$message}','message_id={$messageId}'}" />
     
    Last edited: Aug 14, 2013
  3. Trekkan

    Trekkan Well-Known Member

    Very awesome, I'll be picking this up soon!
     
  4. lasertits

    lasertits Active Member

    Nice! Time to lay my greasy palms all over this.

     
  5. giorgino

    giorgino Well-Known Member

    I've tried to register to your forum, but captcha don't allow me to register :confused:
     
  6. Allan

    Allan Well-Known Member

    Great great job Darkimmortal !

    Integration perfect (y)
     
  7. Veer

    Veer Well-Known Member

    That's awesome work, great add-on!
     
  8. Brogan

    Brogan XenForo Moderator Staff Member

    Nice work.

    When you first suggested this I wasn't too interested but now I am seriously considering it.
     
  9. lasertits

    lasertits Active Member

    Hey Dark, loving it thus far. I'm trying to add the rating counts to my custom header bar:

    [​IMG]

    but they're coming up as zeros. I've tried adding the following in your event listener (though I hate having to edit your code in case of updates):
    Code:
            else if ($hookName == 'header_bar_ratings')
            {   
                $params = $template->getParams();
                $params += $hookParams;
                $content .= $template->create('dark_postrating_header_bar', $params);       
            }
    
    but I'm not having any luck. The header_bar_ratings hook is in my custom header_bar template, and the dark_postrating_header_bar template is simply:
    Code:
    {xen:phrase ratings}: <span style="color:@ratingPositive">+{xen:number $postrating_ratings_total.positive}</span> / {xen:number $postrating_ratings_total.neutral} / <span style="color:@ratingNegative">-{xen:number $postrating_ratings_total.negative}</span>
    I'm not too keen on params and the like across templates. :oops: Perhaps you (or anyone?) can point me in the right direction? I have an odd feeling it's something silly and right under my nose...

    Thanks
     
  10. Skeletor

    Skeletor Member

    Very cool. Thanks! :D
     
  11. Alex

    Alex Active Member

    Excellent just what I've been looking for, now another step closer to migrating over
     
  12. Garamond

    Garamond Well-Known Member

    Very good! Hereby purchased :)
     
  13. Garamond

    Garamond Well-Known Member

    Just do it ;) in some areas it might be 1 step back but overall it's three forward!
     
    Lisa and Darkimmortal like this.
  14. Luke F

    Luke F Well-Known Member

    I've just tested and not having any issue? Perhaps you just got a bad captcha ;)


    You need to pass through a user object, so something like this in place of the hook code you've got there:

    Code:
                $params = $template->getParams();
                $params += $hookParams;
                $params += array(
                    "user" => XenForo_Visitor::getInstance()
                );
                $content .= $template->create('dark_postrating_header_bar', $params);
    And also you would need to add your template name to this conditional:

    Code:
            } else if($templateName == 'dark_postrating_member' || $templateName == 'dark_postrating_member_totals' || $templateName == 'dark_postrating_member_card'){
     
    lasertits likes this.
  15. lasertits

    lasertits Active Member

    That worked! Thanks! :D
     
    Darkimmortal likes this.
  16. Pras

    Pras Member

    just bought it ...

    i have a rank system based on "likes received" ... do all forms of like increase that "likes received" number ? ... or only the "normal" one ?
     
  17. Luke F

    Luke F Well-Known Member

    You would need to change your rank system to be based on positive ratings received. The likes received is still increased, but only for 'like' ratings.
     
  18. Pras

    Pras Member

    okay will do that ... thanks for the mod ;)
     
    Darkimmortal likes this.
  19. giorgino

    giorgino Well-Known Member

    :unsure:

    Schermata 01-2455930 alle 14.25.15.png

    Schermata 01-2455930 alle 14.26.34.png
     
  20. Fuhrmann

    Fuhrmann Well-Known Member

    This is amazing! Like the FacePunch forums! Thank you so much!
     

Share This Page