Chào mừng bạn đến vói vietvbb.vn. Hãy Đăng nhập hoặc Đăng Ký để tham gia thảo luận tại diễn đàn.



Results 1 to 5 of 5

Thread: How to turn the "Post Thank You" hack into a "Likes" system similar to vBulletin.org

  1. How to turn the "Post Thank You" hack into a "Likes" system similar to vBulletin.org Detail »»

  2. How to turn the "Post Thank You" hack into a "Likes" system similar to vBulletin.org

    • pokemon's Avatar
    • pokemon
    • Administrator
    • Administrator
    • Join Date
      10 January 2011
      Location
      HN
      Posts
      3.294
      Thanks
      552
      Thanked 1.578 Times in 1.099 Posts
      Rep Power
      185
    Rating:  (1 votes - 5,00 average)
    Chuyển mod post thanks you thành dạng Like như vbulletin.org


    Note: These instructions are for VB 3.8. See post #3 for a VB4 adaptation.

    First off, the "Likes" system on vBulletin.org is custom and does not use any other hacks- however it is too custom to be released. Instead you can modify an existing mod to do mostly the same thing.

    Several people have asked me for info on how to do this so I figured I'd write it up and post it here.

    You can see what it looks like on my live forum: http://www.juot.net/forums/showthread.php?t=60059



    You need the latest version Abe1's Post Thank You Hack (7.7): Here.

    What you can see above was done with this mod plus some phrase changes and template edits, and an optional plugin edit.

    So step 1 is make sure you have the “Thank You” mod installed and working.

    Step 2 is to change the following phrases. In Admin CP use Phrase Manager to "translate" these phrases from "Thank You" to "Like(s)":

    You can of course use your own translations but this is what I used-

    Phrase Name | Translation:
    post_thanks_already | You have already liked this post!
    post_thanks_remove_user | Remove Your Like
    post_thanks_search | Find All Liked Posts
    post_thanks_search_user | Find all liked posts by {1}
    post_thanks_search_user_gave | Find all posts liked by {1}
    post_thanks_thanked_post | Liked Post
    post_thanks_thanks | Likes
    post_thanks_time_post | Liked 1 Time in 1 Post
    post_thanks_times_post | Liked {1} Times in 1 Post
    post_thanks_times_posts | Liked {1} Times in {2} Posts
    post_thanks_total_thanks | Total Likes
    post_thanks_user_says | The Following User Likes This Post:
    post_thanks_users_say | The Following {1} Users Like This Post:

    Some of the above we won't actually use in my implementation but best to fix them all to be consistent.

    Step 3:

    At this point we need to have a "like.png" file in your images/buttons/ directory and the button directory for every custom style you have, if any. I will attach a couple of options but consider finding or making one unique to your forum.

    Step 4:

    Now we have to edit a couple of templates.

    Edit the template: post_thanks_button

    Replace it all with this:

    PHP Code:
    <a href="post_thanks.php?$session[sessionurl]do=post_thanks_add&amp;p=$post[postid]&amp;securitytoken=$bbuserinfo[securitytoken]id="post_thanks_button_$post[postid]"<if condition="$vboptions[disable_ajax] != 2"onclick="return post_thanks_give($post[postid], <if condition="$vboptions[post_groan_integrate]">true<else />false</if>);"</if> <if condition="$display_thanks_image == 'none'">style="display:none"</if> rel="nofollow"><img src="$stylevar[imgdir_button]/like.png" alt="Like This Post" border="0" /></a
    Note: The above template will work correct if you use the "Post Groan Hack" which I also use. You can convert the "Post Groan Hack" into an "dis-like" system basiclly the same way we are changing "Thank You" to "Likes."


    Edit the template: post_thanks_postbit_legacy OR post_thanks_postbit (whichever postbit you use)

    Replace it all with this:

    PHP Code:
    <div style="background-color: #CAEBDA; border: 2px ridge #7BBA99; border-width: 2px 2px 2px 2px; padding: 2px; width:99%; margin: 0px auto 0px auto; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; margin-top:auto; margin-bottom:0px;">

    <
    table border="0" width="100%">
    <
    tr>
    <
    td width="100">
    <
    strong>Likes: ($post[post_thanks_amount_formatted])</strong><br />
                    
    </
    td><td>
    <
    div style="float:left;">$post[post_thanks_bit]</div> <div style="float:right;"><if condition="$bbuserinfo['usergroupid'] == 6"><a href="post_thanks.php?do=post_thanks_remove_all&amp;p=$post[postid]"<if condition="$vboptions[disable_ajax] != 2"onclick="return post_thanks_remove_all($post[postid], <if condition="$vboptions['post_groan_integrate']">true<else />false</if>);"</if> rel="nofollow">Delete All</a></if><if condition="$bbuserinfo['usergroupid'] == 6 AND $post['show_thanks_remove_option']"> | </if><if condition="$post['show_thanks_remove_option']"><a href="post_thanks.php?do=post_thanks_remove_user&amp;p=$post[postid]"<if condition="$vboptions['disable_ajax'] != 2"onclick="return post_thanks_remove_user($post[postid], <if condition="$vboptions['post_groan_integrate']">true<else />false</if>);"</if> rel="nofollow">Unlike</a></if></div>
    </
    td></tr></table>
    </
    div

    At this point you should have a nice light-green "Like" box appearing below each post someone "Likes." You might want to stop here.

    The last steps are only if you want to integrate the Like box INTO the posts like on my forum.

    If you do the next step is pretty easy-

    In Admin CP -> Plugin Manager, edit the plugin: Post Thank You Hack on hook: postbit_display_start

    Find the line:

    PHP Code:
    eval('$template_hook[postbit_end] .= " ' fetch_template('post_thanks_box') . '";'); 
    and change it to:

    PHP Code:
    eval('$template_hook[postbit_signature_end] .= " ' fetch_template('post_thanks_box') . '";'); 
    OK This will move the "Like" box into the actual post table instead of below it.

    Again this is a good place to stop if you are happy.

    However there is one more template edit I did to keep the Like Box inside the post but at the very bottom of it regardless how short the post might be. In this case we must edit the postbit_legacy template. (I don't use the regular postbit template so I don't have any further instructions for people who use regular postbit. The following is ONLY for postbit_legacy.)

    IMPORTANT- Copy all of your postbit_legacy template to a text file and save it as a backup in case you make an error or the instructions don't work for you. You can also "Revert" the template but that will undo ALL customizations you may have made.

    Find in postbit_legacy:

    PHP Code:
    <td class="alt2" width="175" style="border: $stylevar[cellspacing]px solid $stylevar[tborder_bgcolor]; border-top: 0px; border-bottom: 0px"
    Change it to:

    PHP Code:
    <td class="alt2" rowspan="2" width="175" style="border: $stylevar[cellspacing]px solid $stylevar[tborder_bgcolor]; border-top: 0px; border-bottom: 0px"
    Find:

    PHP Code:
    $template_hook[postbit_signature_end
    And delete it.

    Find:

    PHP Code:
            <!-- / edit note -->
            </if>

        </
    td>
    </
    tr

    Add BELOW it:

    PHP Code:
    <tr>
    <
    td class="alt1" valign="bottom">
    $template_hook[postbit_signature_end]
    </
    td>
    </
    tr
    ----

    And that should do it.

    Of course you are encouraged to make some customizations... Most of what you'll want to change is in the top part of the post_thanks_postbit_legacy template. The background color, border style, and the like are all controlled by this code:

    PHP Code:
    <div style="background-color: #CAEBDA; border: 2px ridge #7BBA99; border-width: 2px 2px 2px 2px; padding: 2px; width:99%; margin: 0px auto 0px auto; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; margin-top:auto; margin-bottom:0px;"
    On my forum I actually use a background image texture but did not include it here as it is an unnecessary complication.

    Feel free to play around and tweak the box to your liking. :up:
    Attached Images Attached Images

  3. The Following User Says Thank You to pokemon For This Useful Post:

    slippinjimmy (23 September 2015)

  4. Comments

  5. #2
    Join Date
    13 February 2012
    Posts
    100
    Thanks
    23
    Thanked 6 Times in 5 Posts
    Rep Power
    9
    bản 7.8.4 mới nhất ở vietvbb có dùng được ko ạ?

  6. #3
    Join Date
    10 January 2011
    Location
    HN
    Posts
    3.294
    Thanks
    552
    Thanked 1.578 Times in 1.099 Posts
    Rep Power
    185
    Cho vbb4


    Mở template post_thanks_box thay chỗ code trong đó bằng cái này:

    PHP Code:
    <div <vb:if condition="!$post_thanks_box == 1"style="background-color: #f2f6f8; border: 1px ridge #417394; border-width: 1px 1px 1px 1px; padding: 2px; width:92%; margin: 

    0px auto 0px auto; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; margin-top:10px; margin-bottom:0px;display:none" 
    <vb:else /> 
    style="background-color: #f2f6f8; border: 1px ridge #417394; border-width: 1px 1px 1px 1px; padding: 2px; width:92%; margin: 0px auto 0px auto; -webkit-border-radius: 5px; -

    moz-border-radius: 5px; border-radius: 5px; margin-top:10px; margin-bottom:0px;"
    </vb:if> id="post_thanks_box_{vb:raw post.postid}">
    {
    vb:raw post_thanks_box}
    </
    div
    Trong template posbit_legacy hoặc postbit tìm:
    PHP Code:
    <vb:if condition="$show['postedited'] || $post['signature']"
    Thêm vào trên nó:

    PHP Code:
    {vb:raw template_hook.postbit_messagearea_end
    ***********Hoặc nếu muốn khung like ở ngay dưới chữ ký

    Trong template posbit_legacy hoặc postbit tìm:
    PHP Code:
    <div class="cleardiv"></div
    Thay bằng

    PHP Code:
    <div class="cleardiv">{vb:raw template_hook.postbit_messagearea_end}</div
    Vào Admin CP -> Plugin Manager, Sửa plugin: Post Thank You Hack ở hook: postbit_display_complete

    Tìm:
    PHP Code:
    $template_hook['postbit_end'] .= $templater->render(); 
    Thay bằng:
    PHP Code:
        $template_hook['postbit_messagearea_end'] .= $templater->render(); 


    Bạn cũng có thể sửa nội dung của khu nhận thank ở dưới:

    Trong template post_thanks_postbit tìm:

    PHP Code:
        <h2 class="<vb:if condition="!$vboptions['legacypostbit']">post</vb:if>title">
            <
    vb:if condition="$post['post_thanks_amount'] == 1">
                {
    vb:rawphrase post_thanks_user_says, {vb:raw post.username}}
            <
    vb:else />
                {
    vb:rawphrase post_thanks_users_say, {vb:raw post.post_thanks_amount_formatted}, {vb:raw post.username}}
            </
    vb:if>
        </
    h2>
        <
    div class="content">
            <
    div id="post_thanks_bit_{vb:raw post.postid}">
                <
    blockquote class="postcontent restore">
                    {
    vb:raw post.post_thanks_bit}
                </
    blockquote>
            </
    div>
        </
    div
    thay bằng:
    PHP Code:
        <div class="content">
            <
    div id="post_thanks_bit_{vb:raw post.postid}">
                <
    blockquote class="postcontent restore">
                    <
    strong><vb:if condition="$post['post_thanks_amount'] == 1">
                {
    vb:rawphrase post_thanks_user_says, {vb:raw post.username}}
            <
    vb:else />
                {
    vb:rawphrase post_thanks_users_say, {vb:raw post.post_thanks_amount_formatted}, {vb:raw post.username}}
            </
    vb:if>
     </
    strong>{vb:raw post.post_thanks_bit}
                </
    blockquote>
            </
    div>
        </
    div
    BR

  7. The Following User Says Thank You to pokemon For This Useful Post:

    slippinjimmy (23 September 2015)

  8. #4
    Join Date
    29 January 2010
    Posts
    159
    Thanks
    32
    Thanked 16 Times in 15 Posts
    Rep Power
    12
    Ôi lằng nhằng kinh, có ai trans hộ không

  9. #5
    Join Date
    10 January 2011
    Location
    HN
    Posts
    3.294
    Thanks
    552
    Thanked 1.578 Times in 1.099 Posts
    Rep Power
    185
    Quote Originally Posted by khanhnguyenqng View Post
    Ôi lằng nhằng kinh, có ai trans hộ không
    của bạn : https://translate.google.com.vn/tran...014&edit-text=

    Rút gọn link - Url Shortner : http://u.vnpsc.com



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [Major Additions] ProvB - Extra Threadfields Light (Fields other Than "Title" & "Message")
    By thanhdia in forum vBulletin 4.x.x Add-ons
    Replies: 7
    Last Post: 25 December 2012, 01:13 PM
  2. [HELP] Xóa 3 cột "New Post" "Thread" Và "Post" Vbb4
    By hanhclubbl01 in forum vB4 Thảo Luận Chung
    Replies: 12
    Last Post: 25 April 2012, 06:10 PM
  3. [Show Thread Enhancements] [hide] hack incl post thank you "addon"
    By noob_v2b in forum vBulletin 3.7 Add-ons
    Replies: 58
    Last Post: 3 September 2010, 02:14 PM
  4. [HELP] chuyển "Đánh dấu là đã đọc" &"Nhóm điều hành" xuống
    By famhoa in forum vB3 Thảo Luận Chung
    Replies: 0
    Last Post: 2 August 2009, 09:07 AM
  5. Replies: 6
    Last Post: 28 September 2008, 01:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •