Status
Not open for further replies.

cclaerhout

Customer
Hello, first of all thank for your this hack. It's great. But, because there is a "but", the documentation is... not ^^. Fortunately there is this forum, but the information are everywhere so it takes time to collect them. The purpose of this post is to put them together. And only for vBulletin 3.8 Professional version.

I- On vB 4 the "Post Thanks / Like" under every message is pretty, but on vB 3, it's ugly.
NOTE:If you do that, you will have to use the "(Pro) Integrate Action Buttons" option of your Admincp->DBTech - Post Thanks->Settings->General Options
The solution is in this thread.
UPDATE LINK

First you will have to edit the JavaScript file "dbtech/thanks/clientscript/thanks.js" (see here)
UPDATE LINK
Then you will have to edit the Template "dbtech_thanks_postbit_entries" (see here, you will have two options. I personally prefere the second one)
UPDATE LINK

II- I love the "Post Thanks / Like" stats in the Postbit BUT they are always collapsed.
The solution is given is this thread.
You will have to edit the Template "dbtech_thanks_postbit" (see here).

Edit: this solution is working, but if you press F5, it you invert the collapse option. So here is a more radical solution:
In "dbtech_thanks_postbit" search:
Code:
<div id="collapseobj_$post[thankspostid]" style="$post[thankscollapseobj]">
And replace with:
Code:
<div id="collapseobj_$post[thankspostid]" style="display:none;">

III- I used the "(Pro) Integrate Action Buttons" option, but I don't want any text, just buttons
I guess there are several ways to do it, but I've chosen the one that use two buttons for each "buttons category". What does it mean ? When you GIVE a "thank", the button is in color. When you want to TAKE BACK your thank, the button is in grey.

So the first thing you need is that grey buttons. I did for you: dislikes_off.pnglikes_off.pngthanks_off.png
The next step is to edit your template (dbtech_thanks_postbit_entries_actionbit) and replace its content with the following simple line of code :
Code:
<a href="javascript://" onclick="Thanks{$post[postid]}.ajax_call('{$button[varname]}');">{$phrase}</a>
Explanation:This edit will in fact suppress the default button system ^^
So, the next step is to edit each button one by one. I'm giving you on example. Let's edit the "Thanks" button.​

Go to Action Text and insert this code (you will of course to edit it):
Code:
<img width="18" height="18" border="0" alt="[B]Put your message here for adding a thank[/B]" src="http://[B]www.your-forum-link.com[/B]/forum/dbtech/thanks/images/[B]thanks.png[/B]" />
Go to Undo Text and insert this code (you will of course to edit it):
Code:
<img width="18" height="18" border="0" alt="[B]Put your message here for taking back a thank[/B]" src="http://[B]www.your-forum-link.com[/B]/forum/dbtech/thanks/images/[B]thanks[COLOR="#FF8C00"]_off[/COLOR].png[/B]" />

Do this for every of your buttons.

Please note that:
  1. The alt attribute of the <img> tag can't be filled with the {$button[title]} variable. It won't be parsed.
  2. When you just press the "give a thank" button, the image description (text alt of attribute) will be displayed, but once the "take back my thank" button which appear using AJAX, it's description won't be displayed. The page need to be reloaded for that. But it's really a minor "problem".

V- I have imported the Thanks data from "Post Thank You Hack" but its stats are not displayed in postbit
Just go to your Admincp->DBTech - Post Thanks->Maintenance and Recalculate & Rebuild statistics.

VI- In the public section how can I search inside the Stats ?
First of all there is a little problem inside the dbtech/thanks_pro/actions/list.php file. You have to edit it, search for the five :
Code:
$hook_query_where .= 'AND entry.
and replace to :
Code:
$hook_query_where .= ' AND entry.
Explanation: A space is missing. When you want to use more than two parameters in your search, it will cause a SQL error.​



There's no particular function yet, but you can perform this search adding information to the url of thanks.php. Here are some examples.

Two parameters search:
I want to see all the "thanks" given by Administrator (userid 1) :
Code:
http://[B]www.your-forum-link.com[/B]/forum/thanks.php?do=list&varname=[B]thanks[/B]&userid=[B]1[/B]

I want to see all the "likes" given by Bobby (userid 33) :
Code:
http://[B]www.your-forum-link.com[/B]/forum/thanks.php?do=list&varname=[B]likes[/B]&userid=[B]33[/B]

I want to see all the "thanks" given TO this Great Administator (userid 1):
Code:
http://[B]www.your-forum-link.com[/B]/forum/thanks.php?do=list&varname=[B]thanks[/B]&receiveduserid=[B]1[/B]

I want to see all the "thanks" given inside the thread dedicated to surfing (threadid 12345):
Code:
http://[B]www.your-forum-link.com[/B]/forum/thanks.php?do=list&varname=[B]thanks[/B]&contentid=[B]12345[/B]

Three parameters search:
I want to see all the "Likes" Bobby (userid 33) has given to the Administrator (userid 1):
Code:
http://[B]www.your-forum-link.com[/B]/forum/thanks.php?do=list&varname=[B]likes[/B]userid=[B]33[/B]&receiveduserid=[B]1[/B]

Four parameters search:
I want to see all the "Likes" Bobby (userid 33) has given to the Administrator (userid 1) in the thread dedicated to surfing (theadid 12345):
Code:
http://[B]www.your-forum-link.com[/B]/forum/thanks.php?do=list&[U]varname[/U]=[B]likes[/B][U]userid[/U]=[B]33[/B]&[U]receiveduserid[/U]=[B]1[/B]&[U]contentid[/U]=[B]12345[/B]



So why all of this ? Because I now can make the hack I wanted to do (see here) very easily ! :)

La vie est belle !

Thanks again. Hope this tutorial will help 3.8 users.
 
Last edited:
Reminder button modification

VII - Reminder button modification
I wanted a hack to help members not to forget to reply a message (see here). Thanks to the professional edition of "DragonByte Technologies Advanced Post Thanks / Like", I made it. I'm going to share the modification I made, hoping one day something similar will be integrated by default :p

My problem was that I didn't want other users can see when a member has pressed that button. I wanted what can be called a "private member button". So I did a few PHP and template modifications (see 1). Then I wanted to use the vBulletin notification system to help members to remind to reply to the messages they have clicked (see 2). But first I want to insist: this modification will only works with
  1. a button which variable (id) is "reminder"
  2. the professional version of "DragonByte Technologies Advanced Post Thanks / Like" (need to access a particular php file)


1) PHP and template modifications
********************************************
* PHP FILES *
********************************************
In dbtech/thanks_pro/actions/LIST.PHP
********************************************

Search:
Code:
$userid 			= $vbulletin->input->clean_gpc('r', 'userid', 			TYPE_UINT);
$receiveduserid 	= $vbulletin->input->clean_gpc('r', 'receiveduserid', 	TYPE_UINT);
$contenttype 		= $vbulletin->input->clean_gpc('r', 'contenttype', 		TYPE_STR);
$contentid 			= $vbulletin->input->clean_gpc('r', 'contentid', 		TYPE_UINT);

Replace with:
Code:
// global userid
global $bbuserinfo;

//If 'reminder" button, then 'userid' option value in 'thanks.php' url will always be the id of the curent
if ($varname == '[B]reminder[/B]')
{
	$userid 			= $vbulletin->userinfo[userid];
}
else
{
	$userid 			= $vbulletin->input->clean_gpc('r', 'userid', 			TYPE_UINT);
	$receiveduserid 	= $vbulletin->input->clean_gpc('r', 'receiveduserid', 	TYPE_UINT);
	$contenttype 		= $vbulletin->input->clean_gpc('r', 'contenttype', 		TYPE_STR);
	$contentid 			= $vbulletin->input->clean_gpc('r', 'contentid', 		TYPE_UINT);
}

Search:
Code:
	$templater = vB_Template::create('dbtech_thanks_list_bit');
		$templater->register('username', '<a href="' . $link . '" target="_blank">' . $results_r['musername'] . '</a>');
		$templater->register('receivedusername', '<a href="' . $link3 . '" target="_blank">' . $received['musername'] . '</a>');
		$templater->register('post', '<a href="' . $link2 . '#post' . $results_r['postid'] . '" target="_blank">' . $title . '</a>');
		$templater->register('time', vbdate($vbulletin->options['dateformat'], $results_r['dateline']) . ' ' . vbdate($vbulletin->options['timeformat'], $results_r['dateline']));
		$templater->register('entrytype', $lookup["$results_r[varname]"]);
	$results .= $templater->render();

Replace with
Code:
	if ($results_r[varname] != "[B]reminder[/B]")
	{
	$templater = vB_Template::create('dbtech_thanks_list_bit');
		$templater->register('username', '<a href="' . $link . '" target="_blank">' . $results_r['musername'] . '</a>');
		$templater->register('receivedusername', '<a href="' . $link3 . '" target="_blank">' . $received['musername'] . '</a>');
		$templater->register('post', '<a href="' . $link2 . '#post' . $results_r['postid'] . '" target="_blank">' . $title . '</a>');
		$templater->register('time', vbdate($vbulletin->options['dateformat'], $results_r['dateline']) . ' ' . vbdate($vbulletin->options['timeformat'], $results_r['dateline']));
		$templater->register('entrytype', $lookup["$results_r[varname]"]);
	$results .= $templater->render();			
	}
	elseif ($results_r[varname] = "[B]reminder[/B]" AND $results_r[userid] == $vbulletin->userinfo[userid])
	{
		$templater = vB_Template::create('dbtech_thanks_list_bit');
		$templater->register('username', '<a href="' . $link . '" target="_blank">' . $results_r['musername'] . '</a>');
		$templater->register('receivedusername', '<a href="' . $link3 . '" target="_blank">' . $received['musername'] . '</a>');
		$templater->register('post', '<a href="' . $link2 . '#post' . $results_r['postid'] . '" target="_blank">' . $title . '</a>');
		$templater->register('time', vbdate($vbulletin->options['dateformat'], $results_r['dateline']) . ' ' . vbdate($vbulletin->options['timeformat'], $results_r['dateline']));
		$templater->register('entrytype', $lookup["$results_r[varname]"]);
	$results .= $templater->render();
	}


********************************************
In dbtech/thanks/hooks/POSTBIT_DISPLAY_COMPLETE.PHP
********************************************
Search:
Code:
				$templater = vB_Template::create('dbtech_thanks_postbit_entries_entrybit');
					$templater->register('post', $post);		
					$templater->register('button', $button);
					$templater->register('users', implode(', ', (array)THANKS::$entrycache["$post[postid]"]["$button[varname]"]['data']));
					$templater->register('otherusers', implode(', ', (array)THANKS::$entrycache["$post[postid]"]["$button[varname]"]['totals']));
				$entries .= $templater->render();

Replace with:
Code:
			//If button {reminder} AND if current user has clicked on it, just show him its button
			if ($button[varname] == "[B]reminder[/B]" AND array_key_exists($vbulletin->userinfo['userid'], (array)THANKS::$entrycache["$post[postid]"]["$button[varname]"]['data']))
			{
			$user_select = THANKS::$entrycache["$post[postid]"]["$button[varname]"]['data']["{$vbulletin->userinfo['userid']}"];
			}
			//If button {reminder} AND if current user has not clicked on it, kill button
			elseif ($button[varname] == "[B]reminder[/B]")
			{
			unset($user_select);
			}
			//In other cases (normal mode)
			else
			{
			$user_select = THANKS::$entrycache["$post[postid]"]["$button[varname]"]['data'];
			}
			
			if (!empty(THANKS::$entrycache["$post[postid]"]["$button[varname]"]['data']))
			{
										
				$templater = vB_Template::create('dbtech_thanks_postbit_entries_entrybit');
					$templater->register('post', $post);		
					$templater->register('button', $button);
					$templater->register('user_select', $user_select);
					$templater->register('users', implode(', ', (array)$user_select));
					$templater->register('otherusers', implode(', ', (array)THANKS::$entrycache["$post[postid]"]["$button[varname]"]['totals']));
				$entries .= $templater->render();
			}

Added 2011/08/26
Search:
Code:
	$templater = vB_Template::create('dbtech_thanks_postbit_stats');
		$templater->register('title', $button['title'] . ' (' . $vbphrase['dbtech_thanks_given'] . ')');
		$templater->register('stat', $post[$button['varname'] . '_given']);
	$thanks_postbit_stats .= $templater->render();
		
	$templater = vB_Template::create('dbtech_thanks_postbit_stats');
		$templater->register('title', $button['title'] . ' (' . $vbphrase['dbtech_thanks_received'] . ')');
		$templater->register('stat', $post[$button['varname'] . '_received']);
	$thanks_postbit_stats .= $templater->render();

Replace with:
Code:
	if ($button[varname] != "[B]reminder[/B]")	
	{
		$templater = vB_Template::create('dbtech_thanks_postbit_stats');
			$templater->register('title', $button['title'] . ' (' . $vbphrase['dbtech_thanks_given'] . ')');
			$templater->register('stat', $post[$button['varname'] . '_given']);
		$thanks_postbit_stats .= $templater->render();
		
		$templater = vB_Template::create('dbtech_thanks_postbit_stats');
			$templater->register('title', $button['title'] . ' (' . $vbphrase['dbtech_thanks_received'] . ')');
			$templater->register('stat', $post[$button['varname'] . '_received']);
		$thanks_postbit_stats .= $templater->render();	
	}

********************************************
In dbtech/thanks/action/AJAX.PHP
********************************************

Search:
Code:
			$templater = vB_Template::create('dbtech_thanks_postbit_entries_entrybit');
				$templater->register('post', $post);		
				$templater->register('button', $button);
				$templater->register('users', implode(', ', (array)THANKS::$entrycache["$post[postid]"]["$button[varname]"]['data']));
				$templater->register('otherusers', implode(', ', (array)THANKS::$entrycache["$post[postid]"]["$button[varname]"]['totals']));
			$entries .= $templater->render();

Replace with:
Code:
			//If button {reminder} AND if current user has clicked on it, just show him its button
			if ($button[varname] == "[B]reminder[/B]" AND array_key_exists($vbulletin->userinfo['userid'], (array)THANKS::$entrycache["$post[postid]"]["$button[varname]"]['data']))
			{
			$user_select = THANKS::$entrycache["$post[postid]"]["$button[varname]"]['data']["{$vbulletin->userinfo['userid']}"];
			}
			//If button {reminder} AND if current user has not clicked on it, kill button
			elseif ($button[varname] == "[B]reminder[/B]")
			{
			unset($user_select);
			}
			//In other cases (normal mode)
			else
			{
			$user_select = THANKS::$entrycache["$post[postid]"]["$button[varname]"]['data'];
			}
			
			if (!empty(THANKS::$entrycache["$post[postid]"]["$button[varname]"]['data']))
			{
										
				$templater = vB_Template::create('dbtech_thanks_postbit_entries_entrybit');
					$templater->register('post', $post);		
					$templater->register('button', $button);
					$templater->register('user_select', $user_select);
					$templater->register('users', implode(', ', (array)$user_select));
					$templater->register('otherusers', implode(', ', (array)THANKS::$entrycache["$post[postid]"]["$button[varname]"]['totals']));
				$entries .= $templater->render();
			}


********************************************
In dbtech/thanks/includes/class_profileblock.php
********************************************
Search:
Code:
			// Ensure we have the proper day selected for the grouping
Replace with:
Code:
			// If button {reminder}  AND  this button hasn't been pressed by the current user, skip the rest of the current loop 
			if ($results_r[varname] == "[B]reminder[/B]" AND $results_r[userid] != $this->profile->userinfo['userid'])
			{
			continue;
			}
			
			// Ensure we have the proper day selected for the grouping

********************************************
* TEMPLATES *
********************************************
In dbtech_thanks_postbit_entries_entrybit
********************************************
Put at the beginning of your template this conditional:
Code:
<if condition="$user_select">
And close it at the end of your template:
Code:
</if>


2) PHP and template modifications
I've done a product file, it will be easier to import. Download it and install it.


3)Misc
>I've done a product file, it will be easier to import. Download it and install it.
>If you want a picture to work with this picture, you can use these: reminder_off.pngreminder.png
They are free and come from here.
>My code is certainly not the best one, but everything is working well on my forum :)
 

Attachments

  • product-db_reminder.xml
    2.1 KB · Views: 0
Last edited:
VIII - Buttons on the left side of edit, reply, quote buttons
The easiest way is to modify your templates postbit and posbit_legacy:

Search:
Code:
		$template_hook[postbit_controls]
		<!-- / controls -->
Replace:
Code:
		<!-- / controls -->
Search:
Code:
		<!-- controls -->
Replace:
Code:
		<!-- controls -->
		$template_hook[postbit_controls]

See here:
left-ex.gif
 
I'm having problems getting the pro version to work in vb3, and the links to your tutorials in the first post are dead. The buttons look terrible, and when clicked open in a new window instead of utilizing the javascript, even with the default vB3 template.
Snap_2011.10.02_09h25m58s_001_.png

Edit: I've used your 'grey' buttons and removed the text, and now it looks fine. Also, the javascript could be a problem with my server, will let you know :)

Edit again: The problem was with my site settings, not the mod...working great now! :)
 
Last edited:
Now the images are showing up twice :(
 

Attachments

  • Ashampoo_Snap_2012.01.02_22h25m30s_001_.jpg
    Ashampoo_Snap_2012.01.02_22h25m30s_001_.jpg
    12.3 KB · Views: 88
Status
Not open for further replies.
Back
Top