Comments (5)
Okay easier than I thought, but I don't know if this is a proper way to do it. I added another function to threadpreview
function threadpreview_getPreview($thread)
{
global $mybb, $db, $tids, $threadcache, $thread, $firstpostcache;
$query = $db->query("SELECT t.tid, t.firstpost, p.message
FROM " . TABLE_PREFIX . "threads t
LEFT JOIN " . TABLE_PREFIX . "posts p
ON(t.firstpost=p.pid)
WHERE t.tid IN(" . $thread['tid'] . ")");
while($data = $db->fetch_array($query))
{
$firstpostcache[$data['tid']] = replaceMedia($data['message']);
//$firstpostcache[$data['tid']] = substr($data['message'], 0, (int)$mybb->settings['threadpreview_maxlength']);
//$threadcache[$data['tid']]['preview'] = $data['message'];
}
// MangaD - parse mycode, smilies...
global $parser;
if(!$parser)
{
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;
}
$parser_options = array(
"allow_html" => (int)$mybb->settings['pmsallowhtml'],
"allow_mycode" => (int)$mybb->settings['pmsallowmycode'],
"allow_smilies" => (int)$mybb->settings['pmsallowsmilies'],
"allow_imgcode" => (int)$mybb->settings['pmsallowimgcode'],
"allow_videocode" => (int)$mybb->settings['pmsallowvideocode'],
"nofollow_on" => 1,
"filter_badwords" => 1
);
$thread['preview'] = $parser->parse_message($firstpostcache[$thread['tid']], $parser_options);
$thread['preview'] = truncateHTML((int)$mybb->settings['threadpreview_maxlength'], $thread['preview']);
}
then inside endless I can call threadpreview_getPreview with the current $thread being created as argument.
from mybb-thread-preview.
Hello, I am not familiar with the endless plugin and have no intention to support it. But as this project is open source, anyone is welcome to contribute.
from mybb-thread-preview.
Alright ;( I don't know much about mybb plugins dev but I will try to find a fix.
from mybb-thread-preview.
The only problem I see is that there's a reference to the $thread global variable inside the function, that possibly conflicts with the argument.
from mybb-thread-preview.
Yea I wasn't sure about how to use those but it's working like that ^^
Removing $thread returns an empty $thread['preview']
from mybb-thread-preview.
Related Issues (2)
- It Doesn't Work HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mybb-thread-preview.