MyBB Hacks

Full Version: Thread Tooltip Preview
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
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
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.
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

Glad it worked and thanks for confirming that.
(Again, I should actually update the plugin above, but need to get around to it >_>)
Updated to v1.33: fixed 0xA0 character bug for UTF-8 encoding.
Thank you very much ZiNgA BuRgA Smile
Just tried to download this but I get errors when trying to unzip it regardless of which program I use.
Cool story bro.
Hi, still I don't understand how to add smilies in lastpostpreview Frown

I have tried in threadtooltip.php:

Code:
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:
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?

(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).
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Reference URL's