How to turn the "Post Thank You" hack into a "Likes" system similar to vBulletin.org
1 Attachment(s)
Note: These instructions are for VB 3.8. See post #35 by michal72 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 https://vborg.vbsupport.ru/attachmen...1&d=1309952895 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: Code:
<a href="post_thanks.php?$session[sessionurl]do=post_thanks_add&p=$post[postid]&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> Edit the template: post_thanks_postbit_legacy OR post_thanks_postbit (whichever postbit you use) Replace it all with this: 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;"> 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: Code:
eval('$template_hook[postbit_end] .= " ' . fetch_template('post_thanks_box') . '";'); Code:
eval('$template_hook[postbit_signature_end] .= " ' . fetch_template('post_thanks_box') . '";'); 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: Code:
<td class="alt2" width="175" style="border: $stylevar[cellspacing]px solid $stylevar[tborder_bgcolor]; border-top: 0px; border-bottom: 0px"> Code:
<td class="alt2" rowspan="2" width="175" style="border: $stylevar[cellspacing]px solid $stylevar[tborder_bgcolor]; border-top: 0px; border-bottom: 0px"> Code:
$template_hook[postbit_signature_end] Find: Code:
<!-- / edit note --> Add BELOW it: Code:
<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: 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;"> Feel free to play around and tweak the box to your liking. :up: |
I've already done most of these edits on one site and plan to do the same on others. But, this should help those searching for an option without doing a custom add-on. Great explanation as always Joe! :up:
UNRELATED: Noticed on this article it will not allow me to "like" (clicking the heart icon) the thread. May want to look into permissions or something on this. |
Quote:
|
"Sorry, you are not allowed to 'Like' this post."
Wasn't the standard, "you've liked this guy's posts too much" message :) |
Hmm, I did everything you said Joe, from step 1 to step 4, plus I did the
Quote:
I may of did something wrong, maybe you can diagnose what's up? lol. |
Quote:
Code:
$template_hook[postbit_signature_end] |
Quote:
PHP Code:
PHP Code:
|
I uninstalled my Thank You hack and re-installed following the instructions here, just in case I missed a step, but it still is working fine following these exact instructions.
Your postbit_legacy template looks fine. I'm at a loss right now. |
Did you have the Thank You mod working right before this?
|
Quote:
Let me try removing the files, and uninstalling the product, and reverting the templates, and re-following the steps to see if it'd work. I'll let you know once I've done this, and hopefully, it'd work, because it must of been an error I caused myself. By the way, if I revert the postbit, and postbit_legacy templates, would it delete the templates? or revert them back to the original way? |
If you are in a style (NOT the Master Style) but in any installed style reverting the template will undo all customizations made to that template in that style. You wouldn't see the Master Style unless you were in debug mode.
No reason to delete the php files, those weren't changed. Also if you uninstall the mod that will erase all the previous "thank yous" you had, I don't see any benefit to uninstalling the mod. Just re-install the mod with "Allow Overwrite" set to YES. Then go to your styles and revert the 2 mod templates edited above, you should be back to a stock Thank You install. And can I have a link to your forum (PM me if you don't want to post it.) |
Quote:
What should I do? |
pm sent.
|
@BOP5 : It awesome ! I will do it for my board, and that is for vBulletin 4. More change I will do.
Thanks again ! -------------- P.S : I still can not like your first post ! |
The Like Post issue has been logged in the big tracker. It will be fixed eventually.
Note- these instructions are for VB3.x only. VB4.x will need different template edits. I don't have the VB4 like button. |
OK The problem with Tasking Mickey was that he was using the standard postbit, not legacy. I updated the instructions above for use with either the regular postbit or postbit_legacy.
On the plus side it's another forum I can confirm this works on. :up: |
I don't see a reason to limit the likes thus farI want them to use the heck out of it.
|
Quote:
|
First, thank you for sharing. :)
I'll test this on my test board, but thought I'd ask here first in case you might have any insight... I'm currently running a modified version of Post Thanks similar to this. I've wanted to add a Like button to my site and was thinking of editing Post Thanks again...similar to what you have provided. Do you think there would be any issue with, let's say... a site running (an unedited) Post Thanks and your Like system simultaneously? TIA! |
@BOP5 : How can you reduce more "Likes" showing in a post like Facebook or here ?
|
Quote:
|
Quote:
|
Quote:
Likes (12): Tasking Mickey, Bird0Prey5, Lynne, Princetoon and 15 others The 15 others, would show the other people who liked that post, it'd be much better, since it won't take up the whole post with like 20 usernames in the like box. |
Quote:
|
Can you please update instructions for latest version 4.1.4
I can't find template hook postbit_display_start (I have postbit_display_complete) |
Quote:
|
Quote:
Please note that this will not work (properly) for vb 4.x.x versions as post thank you hack has phrase changes and plugin changes which are different from 3.8x version. I am only making a note as you have posted on post_thanks vb4.0x version https://vborg.vbsupport.ru/showthrea...31666&page=110 example: There is no plugin with hook postbit_display_start (instead there is postbit_display_complete) |
Quote:
I will take a look at the VB4 version as soon as I get a chance. I have also updated the link and version number in this thread because it was also linking to the 4.x version. |
I would kiss you BirdOPrey5 ;) Thank you for this article.
|
Quote:
FYI to all- Paul has reported the bug preventing the "Liking" of articles here on vb.org is fixed. :up: |
Actually, pretty simple to modify this article for 4.x.x as there are just couple of phrase differences and plugin differences.
Quote:
|
Quote:
Quote:
|
looks there is a problem when somone thanx the post the page needs to refresh again and AJAX feature is not working...
|
Quote:
|
Quote:
Change post_thanks_box template to: PHP Code:
PHP Code:
PHP Code:
Find: PHP Code:
PHP Code:
You can also modify window's content: In post_thanks_postbit template replace: PHP Code:
PHP Code:
|
Thxs michal72
I made one change.. this will place it under the signature In the postbit_legacy i did Find Code:
<div class="cleardiv"></div> Code:
<div class="cleardiv">{vb:raw template_hook.postbit_messagearea_end}</div> |
With this method though, you can't see the likes in your control panel, like you can here, with vbullletin 4.
|
Quote:
|
Quote:
|
Quote:
EDIT: Also for some reason the post thank you hack doesn't seem to be working with the reputation system, even though I've set for all likes to give all users 5 points of reputation, I don't see any reputation added with the likes. Could this be a error caused by these edits or some bug with the mod itself? I am running vbulletin 4.1.4 in my forum. |
All times are GMT. The time now is 02:39 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|