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
Arg Ouch

I use thread tooltip also on forumdisplay_thread, portal etc. If I put in all these templates only the <php> code I'll have problems? PHP will have more requests and then the site slower?

Thank you
Not answering your question, but if you choose to edit the threadtooltip.php, for example, you can add something like this (for search):

PHP Code:
$plugins->add_hook('search_results_thread','threadtooltip_search_results_thread');
function threadtooltip_search_results_thread(){
	global $thread,$parser;
	$thread['postpreview'] = $parser->parse_message($thread['postpreview'], array(
		'allow_html' => 0,
		'allow_mycode' => 0,
		'allow_smilies' => 1,
		'allow_imgcode' => 0,
		'filter_badwords' => 0,
		'nl2br' => 0
	));
}

Then you can disable the $plugins->add_hook('search_results_start', 'threadtooltip_search_template'); and the function (if necessary).

The bad thing is, you need to do that in each hooks where you want ti ti be parsed.

Uhm it doesn't work Frown

At the top of file I have

Code:
$plugins->add_hook('datahandler_post_insert_thread', 'threadtooltip_threadnew');
$plugins->add_hook('datahandler_post_update_thread', 'threadtooltip_threadupdate');
$plugins->add_hook('datahandler_post_insert_post', 'threadtooltip_threadlpupdate');
$plugins->add_hook('search_results_thread','threadtooltip_search_results_thread');
$plugins->add_hook('forumdisplay_thread','threadtooltip_forumdisplay_thread');
$plugins->add_hook('portal_start','threadtooltip_portal_start');

// since I really hate MyBB's find_replace_templatesets()...
$plugins->add_hook('forumdisplay_start', 'threadtooltip_forumdisplay_template');
$plugins->add_hook('search_results_start', 'threadtooltip_search_template');

$plugins->add_hook('admin_tools_recount_rebuild_start', 'threadtooltip_admin_cache');


and after

Code:
function threadtooltip_threadlpupdate(&$ph)
{
	$tid = intval($ph->data['tid']);
	if(!$tid) return;
	$GLOBALS['db']->update_query('threads', array('lastpostpreview' => threadtooltip_getpreview($ph->data['message'])), 'tid='.$tid);
}


added

Code:
function threadtooltip_search_results_thread(){
	global $thread,$parser;
	$thread['postpreview'] = $parser->parse_message($thread['postpreview'], array(
		'allow_html' => 0,
		'allow_mycode' => 0,
		'allow_smilies' => 1,
		'allow_imgcode' => 0,
		'filter_badwords' => 0,
		'nl2br' => 0
	));
}

function threadtooltip_forumdisplay_thread(){
	global $thread,$parser;
	$thread['postpreview'] = $parser->parse_message($thread['postpreview'], array(
		'allow_html' => 0,
		'allow_mycode' => 0,
		'allow_smilies' => 1,
		'allow_imgcode' => 0,
		'filter_badwords' => 0,
		'nl2br' => 0
	));
}

function threadtooltip_portal_start(){
	global $thread,$parser;
	$thread['postpreview'] = $parser->parse_message($thread['postpreview'], array(
		'allow_html' => 0,
		'allow_mycode' => 0,
		'allow_smilies' => 1,
		'allow_imgcode' => 0,
		'filter_badwords' => 0,
		'nl2br' => 0
	));
}


Search threads, forumdisplay_thread, portal..but again smiles like :clapping: Frown
Maybe better use <php>, at least more easy and fast to check and change

postpreview is for the first post preview. You need to use lastpostpreview if you want it for the last post.

But yes, parsing it directly in the templates is more easier.
Can this plugin be modified to show excerpts of first post on the threadlist? Or is there a better way of doing it?

Thanks!
This plugin shows you already the first post at hover?
(10-12-2016 08:43 AM)MrBrechreiz Wrote: [ -> ]This plugin shows you already the first post at hover?

Thanks, I understand that it does that. But if you look at my screenshot in this thread you'll see that I want excerpts to always be displayed. https://community.mybb.com/thread-204832.html

I am wondering if I can modify this plugin so it shows excerpts all the time instead of only when hovered.
Just got it to work. Thanks for this fantastic plugin!
IS there a way to make an option in User CP to turn on/off the tool tips, by default turned on

Also why is the max warning set at 200? Vbulletin seems to have 300 maybe 400?
(11-16-2016 07:30 AM)metulburr Wrote: [ -> ]IS there a way to make an option in User CP to turn on/off the tool tips, by default turned on
Plugin doesn't have the feature, someone would have to modify it to do that.

(11-16-2016 07:30 AM)metulburr Wrote: [ -> ]Also why is the max warning set at 200? Vbulletin seems to have 300 maybe 400?
200 is probably a mistake.  The columns in the table are defined to be length 255, so it'll never allow anything longer than that unless you change the table definition (if you wish to do that, change the max length of the postpreview and lastpostpreview columns of your threads table).
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Reference URL's