Thread Tooltip Preview
Author Message
Displays a basic preview of a thread in forumdisplay/search in a tooltip.  The tooltip acts like any standard tooltip - it will be shown after the mouse is hovered on the table cell containing the thread title.  (will also do it for thread title text itself if the user is not a moderator, in which case, the "click and hold to edit" will override the thread tooltip)

This will also display a tooltip preview for the last post, when the user hovers the mouse on the last post cell in forumdisplay/search (note, this doesn't work for the forum index).

Note: this plugin assumes that you're using the UTF-8 character set everywhere (which MyBB somewhat assumes anyway).

As there are clearly a lot of people who don't read the above, I will say this differently.  This DOES work for moderators and administrators, however you need to hover the mouse on the TABLE CELL for it to appear (not the actual thread link).
(This post was last modified: 11-11-2014 07:16 AM by ZiNgA BuRgA.)
Find all posts by this user
Quote this message in a reply
Download: threadtooltip-1.33.7z (2.65 KB)
Plugin Version: 1.33
Last Updated: 11-11-2014, 07:14 AM

Downloads: 1,957
MyBB Compatibility: 1.4.x, 1.6.x, 1.8.x
Plugin License: WTFPLv2
Uploader: ZiNgA BuRgA
nier3 Offline
Member
***
Posts: 125
Joined: Jul 2012
Post: #121
RE: Thread Tooltip Preview
Hi,
slow pages was from unread posts plugin, deleting "NOT LIKE 'moved|%'" in query for now it's ok Biggrin

For "?" of postpreview problem, I have it in all threads and posts with letters "à" if I understand well, on portal page you can see better: http://mysite.com

For example in the third announcement there's "potr?registrarsi una sola volta e potr?" instead of "potrà registrarsi una sola volta e potrà", also in forumdisplay_thread there's same problem:

http://mysite.com

Always in this example, link to full thread is this: http://mysite.com

In settings of plugin postpreview I have:
Length of Tooltip: 200

Strip MyCode from Tooltip
If yes, tries to strip MyCode from tooltips. Note: this setting is NOT forum setting dependent (ie it will try to strip MyCode even if you disable it)
Yes

I have MySQL 5.5.40 with MySQLi Extension and UTF-8 Unicode (utf8), MySQL connection collation is utf8mb4_general_ci (infos from phpmyadmin).

I don't know where other check Frown I think it's a problem of UTF thing
like here: http://stackoverflow.com/questions/75299...http://stackoverflow.com/questions/7529996/php-character-encoding-%EF%BF%BD-sign-instead
(This post was last modified: 11-14-2014 10:08 PM by nier3.)
11-05-2014 11:43 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #122
RE: Thread Tooltip Preview
Can you double-check that the code replacement suggested before has been applied correctly?  Your post has the correct code.

I can't reproduce your issue with the same text.  It does come up without the code change though.

My Blog
11-06-2014 05:25 PM
Find all posts by this user Quote this message in a reply
nier3 Offline
Member
***
Posts: 125
Joined: Jul 2012
Post: #123
RE: Thread Tooltip Preview
Hi, finally works!

I don't know why but in threadtooltip.php I had still:

PHP Code:
$msg = trim(preg_replace(array('~ {2,}~', "~\n{2,}~"), array(' ', "\n"), strtr($msg, array("\xA0" => ' ', "\r" => '', "\t" => ' '))));


Frown

Instead with:

PHP Code:
$msg = trim(preg_replace(array('~ {2,}~', "~\n{2,}~"), array(' ', "\n"), strtr($msg, array(utf8_encode("\xA0")


and Rebuild Thread Tooltips it works, but I'm sure I edited..I don't know, sorry.

Maybe with change of hosting, upgrade of Mybb etc etc I deleted that edit, sorry Frown

Thank you very much for patience

11-07-2014 10:14 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #124
RE: Thread Tooltip Preview
Glad it worked and thanks for confirming that.
(Again, I should actually update the plugin above, but need to get around to it >_>)

My Blog
11-07-2014 03:33 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #125
RE: Thread Tooltip Preview
Updated to v1.33: fixed 0xA0 character bug for UTF-8 encoding.

My Blog
11-11-2014 07:16 AM
Find all posts by this user Quote this message in a reply
nier3 Offline
Member
***
Posts: 125
Joined: Jul 2012
Post: #126
RE: Thread Tooltip Preview
Thank you very much ZiNgA BuRgA Smile
11-13-2014 07:21 AM
Find all posts by this user Quote this message in a reply
Gentlemanmike Offline
Junior Member
**
Posts: 1
Joined: Jul 2015
Post: #127
RE: Thread Tooltip Preview
Just tried to download this but I get errors when trying to unzip it regardless of which program I use.
07-25-2015 06:16 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #128
RE: Thread Tooltip Preview
Cool story bro.

My Blog
07-27-2015 08:58 AM
Find all posts by this user Quote this message in a reply
nier3 Offline
Member
***
Posts: 125
Joined: Jul 2012
Post: #129
RE: Thread Tooltip Preview
Hi, still I don't understand how to add smilies in lastpostpreview Frown

I have tried in threadtooltip.php:

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function threadtooltip_getpreview(&$message)
{
	global $db, $parser, $mybb;
	
	//$msg = trim(strtr($message, array("\n" => ' ', "\r" => '', "\t" => ' ')));
	$msg = $message;
	if($mybb->settings['threadtooltip_stripmycode'] == 1)
	{
		global $parser;
		if(!is_object($parser))
		{
			require_once MYBB_ROOT.'inc/class_parser.php';
			$parser = new postParser;
		}
		
		$msg = $parser->parse_message($msg, array(
			'allow_html' => $forum['allowhtml'],
			'allow_mycode' => $forum['allowmycode'],
			'allow_smilies' => $forum['allowsmilies'],
			'allow_imgcode' => $forum['allowimgcode'],
			'filter_badwords' => 'yes',
			'nl2br' => 'yes'
		));
		$msg = $parser->parse_message($post['message'], $parser_options);


rebuilt Thread Tooltips but nothing, no smilies in {$thread['lastpostpreview']} but also no text of last post preview in search.php Frown

I would like to use this with View Unread Posts plugin: http://community.mybb.com/thread-71986.html

Where I have to edit/add the code?

Edit:

Ok, with this I have like :clapping:  better that nothing Biggrin

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function threadtooltip_getpreview(&$message)
{
	global $db, $parser, $mybb;
	
	//$msg = trim(strtr($message, array("\n" => ' ', "\r" => '', "\t" => ' ')));
	$msg = $message;
	if($mybb->settings['threadtooltip_stripmycode'] == 1)
	{
		global $parser;
		if(!is_object($parser))
		{
			require_once MYBB_ROOT.'inc/class_parser.php';
			$parser = new postParser;
		}
		
		$msg = $parser->parse_message($msg, $post['message'], $parser_options, array(
			'allow_html' => 'yes',
			'allow_mycode' => 'yes',
			'allow_smilies' => 'yes',
			'allow_imgcode' => 'yes',
			'filter_badwords' => 'yes',
			'nl2br' => 'yes'
		));


but still no image of smiles Frown

EDITTTTTTTTTTT:

This works!!! Added in search_results_threads_thread

Code:
<?php
echo $parser->parse_message(htmlspecialchars_decode($thread['lastpostpreview']),array('allow_smilies'=>1));
?>


Thank you RateU Biggrin http://mybbhacks.zingaburga.com/showthre...http://mybbhacks.zingaburga.com/showthread.php?tid=1248&pid=1052

But why in threadtooltip.php, also with allow smilies on yes, it doesn't work?

(This post was last modified: 11-07-2015 04:04 AM by nier3.)
11-07-2015 03:47 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #130
RE: Thread Tooltip Preview
(11-07-2015 03:47 AM)nier3 Wrote:  But why in threadtooltip.php, also with allow smilies on yes, it doesn't work?

threadtooltip doesn't hook into search_results_thread hook.
You can hook it to the search_results_thread hook and use the parser (maybe you need to "disable" the preview inside the title attribute in threadtooltip_search_template() function).

11-07-2015 04:41 AM
Find all posts by this user Quote this message in a reply


Forum Jump: