vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   How to turn the "Post Thank You" hack into a "Likes" system similar to vBulletin.org (https://vborg.vbsupport.ru/showthread.php?t=266358)

StoppingTime 07-15-2015 02:00 AM

Has anyone been able to integrate this hack with vB's notification system? So for example, every time a user receives a "thanks" or "thumbs up" they'd receive a notification just like they would if they received, say, a VM? If so, how was this accomplished?

blind-eddie 07-15-2015 02:24 AM

Here ya go....

https://vborg.vbsupport.ru/showthread.php?t=279907

StoppingTime 07-16-2015 12:35 AM

Quote:

Originally Posted by blind-eddie (Post 2550242)

Thank you very much, this was just what I was looking for

sv1cec 09-07-2015 06:30 AM

OK, maybe I am a little late in this, but I've installed it, like it but I can't make the box move inside the post area, no matter what I tried.

I can make it move inside but:

- If I put it below the signature, then all the buttons at the bottom of the post get mangled.
- If I put it above the signature, the signature doesn't show and the buttons get mangled again.
- If I put it above the post, everything disappears, and the buttons get screwed up again.

I am using vB 4.2.2 and the postbit (not postbit_legacy) template.

Ideas?

--------------- Added [DATE]1441621426[/DATE] at [TIME]1441621426[/TIME] ---------------

OK, I've managed to solve the issue I had with this hack, or at least, I've managed to move the statistics box inside the postbit area, below the signature. The offending part, was the post_thanks_box template. As it was, when I installed the hack, it looked like this:

Code:

<li class="postbit<vb:if condition="$vboptions['legacypostbit']">legacy</vb:if> postbitim" id="post_thanks_box_{vb:raw post.postid}"<vb:if condition="!$post_thanks_box == 1"> style="display:none"</vb:if>>
        {vb:raw post_thanks_box}
</li>

I changed the li and /li to div and the problem of screwing up the buttons at the end of the post disappeared. So, here is what you have to do, to move the info box inside postbit.

1. Change your post_thanks_box template, to:

Code:

<div class="postbit<vb:if condition="$vboptions['legacypostbit']">legacy</vb:if> postbitim" id="post_thanks_box_{vb:raw post.postid}"<vb:if condition="!$post_thanks_box == 1"> style="display:none"</vb:if>>
        {vb:raw post_thanks_box}
</div>

2. Change the plugin postbit_display_complete in the Plugins manager to:

Code:

require_once(DIR . '/includes/functions_post_thanks.php');

if (!(defined('LOCATION_BYPASS')) && !(post_thanks_off($this->thread['forumid'], $this->post, $this->thread['firstpostid'], THIS_SCRIPT)))
{
        global $ids;

        $thanks = fetch_thanks($this->post['postid'], $ids);

        if (thanked_already($this->post) && $this->registry->options[post_thanks_delete_own])
        {
                $this->post['show_thanks_remove_option'] = true;
        }

        if ($this->post['post_thanks_amount'] > 0 && $this->thread['isdeleted'] == 0)
        {
                $this->post['post_thanks_bit'] = fetch_thanks_bit($this->thread['forumid'], $thanks);
                $this->post['post_thanks_user'] = $post_thanks_user;
                $this->post['post_thanks_amount_formatted'] = vb_number_format($this->post['post_thanks_amount']);

                $post_thanks_box = fetch_post_thanks_template($this->post);
        }

        $templater = vB_Template::create('post_thanks_box');
        $templater->register('post', $post);
        $templater->register('post_thanks_box', $post_thanks_box);
        $template_hook['postbit_signature_end'] .= $templater->render();
}

if ($this->registry->userinfo['userid'] != 0 && !(defined('LOCATION_BYPASS')) && !(post_thanks_off($thread['forumid'], $post, $thread['firstpostid'], THIS_SCRIPT)))
{
        $display_thanks_image = 'none';

        if (can_thank_this_post($post, $thread['isdeleted']) && !thanked_already($post))
        {
                $display_thanks_image = '';
        }

        $templater = vB_Template::create('post_thanks_button');
        $templater->register('post', $post);
        $templater->register('display_thanks_image', $display_thanks_image);
        $template_hook['postbit_controls'] .= $templater->render();
}

if ($this->registry->options['post_thanks_show_stats_postbit'])
{
        $post['post_thanks_user_amount_formatted'] = vb_number_format($post['post_thanks_user_amount']);
        $post['post_thanks_thanked_times_formatted'] = vb_number_format($post['post_thanks_thanked_times']);
        $post['post_thanks_thanked_posts_formatted'] = vb_number_format($post['post_thanks_thanked_posts']);

        $templater = vB_Template::create('post_thanks_postbit_info');
        $templater->register('post', $post);
        $template_hook['postbit_userinfo_right_after_posts'] .= $templater->render();
}

3. You may try using the post_thanks_postbit, the way I changed it, to better fit the postbit template:

Code:

<div style="background-color: #E1E4F3; border: 2px ridge #7BBA99; ; border-width: 2px 2px 2px 2px; padding: 2px; width:100%; margin: 0px auto 0px auto; margin-top:auto; margin-bottom:0px;">

<table border="0" width="100%">
<tr>
<td width="100">
<strong><b>Likes ($post[post_thanks_amount_formatted]) :</b></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>
<br />

I also cleaned up a little the way the "Likes" information is displayed in the user profile. While it is not the perfect way to do it (I should have created more phrases etc), again, as it is, it serves me fine, so I am posting it here.

Code:

<h5 class="subsubsectionhead">{vb:rawphrase post_thanks_total_thanks}</h5>
<dl class="stats">
        <dt>{vb:rawphrase post_thanks_total_thanks} given</dt>
        <dd>{vb:raw userinfo.post_thanks_user_amount_formatted}  -- <a href="post_thanks.php?{vb:raw session.sessionurl}do=findthanks_user_gave&amp;u={vb:raw userinfo.userid}">{vb:rawphrase post_thanks_search_user_gave, {vb:raw userinfo.username}}</a></dd>
</dl>
<dl class="stats">
        <dt>{vb:rawphrase post_thanks_total_thanks} received</dt>
        <dd><vb:if condition="$userinfo[post_thanks_thanked_times] == 1">
                {vb:rawphrase post_thanks_time_post}
        <vb:else />
                <vb:if condition="$userinfo[post_thanks_thanked_posts] == 1">
                        {vb:rawphrase post_thanks_times_post, {vb:raw userinfo.post_thanks_thanked_times_formatted}}
                <vb:else />
                        {vb:rawphrase post_thanks_times_posts, {vb:raw userinfo.post_thanks_thanked_times_formatted}, {vb:raw userinfo.post_thanks_thanked_posts_formatted}}
                </vb:if>
        </vb:if>  --  <a href="post_thanks.php?{vb:raw session.sessionurl}do=findthanks&amp;u={vb:raw userinfo.userid}">{vb:rawphrase post_thanks_search_user, {vb:raw userinfo.username}}</a></dd>
</dl>

My patch is not perfect, as it still screws up the signature, if you attempt to put the box above it, but it works when the box is under the signature and I am happy with it.

I hope this helps some people here.

pjkcards 11-30-2015 11:54 AM

Using the hack from post #35, I'm having a few issues:
1) I click like, then "remove this like", and the page refreshes saying:
"user, you do not have permission to access this page. This could be due to one of several reasons:"
2) Also getting a weird box (I think for the collapse, but that is turned off and it still shows). What's the best way to fix that?
https://www.dropbox.com/s/sk6hcn8789...58.45.png?dl=0
3) When I click "thanks" on a post with other thanks, and then remove my thanks, it collapses the box with other likes so I can't see them until I refresh the page.

Any help resolving this would be appreciated.
Thanks.


All times are GMT. The time now is 02:17 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
  • Page Generation 0.02021 seconds
  • Memory Usage 1,752KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete