Okay but MAKE SURE TO Save a copy of your last version, in case this does not work. If there is an error, tell me what the error is, then revert to your last version.
but try this and see if it works. Just overwrite and click save. Go to profile and see if the changes are what you expect
<?php
/*
* MyBB: Last User's Threads in Profile
*
* File: mybbirlastthreadsprofile.php
*
* Authors: AliReza_Tofighi & updated by Vintagedaddyo
*
* MyBB Version: 1.8
*
* Plugin Version: 1.2
*
*/
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("member_profile_end", "mybbirlastthreadsprofile");
function mybbirlastthreadsprofile_info()
{
global $lang;
$lang->load("mybbirlastthreadsprofile");
$lang->mybbirlastthreadsprofile_Desc = '<form action="https://www.paypal.com/cgi-bin/webscr" method="post" style="float:right;">' .
'<input type="hidden" name="cmd" value="_s-xclick">' .
'<input type="hidden" name="hosted_button_id" value="AZE6ZNZPBPVUL">' .
'<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">' .
'<img alt="" border="0" src="https://www.paypalobjects.com/pl_PL/i/scr/pixel.gif" width="1" height="1">' .
'</form>' . $lang->mybbirlastthreadsprofile_Desc;
return Array(
'name' => $lang->mybbirlastthreadsprofile_Name,
'description' => $lang->mybbirlastthreadsprofile_Desc,
'website' => $lang->mybbirlastthreadsprofile_Web,
'author' => $lang->mybbirlastthreadsprofile_Auth,
'authorsite' => $lang->mybbirlastthreadsprofile_AuthSite,
'version' => $lang->mybbirlastthreadsprofile_Ver,
'compatibility' => $lang->mybbirlastthreadsprofile_Compat
);
}
function mybbirlastthreadsprofile_activate(){
global $mybb, $db;
include MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("member_profile", "#".preg_quote('{$mybbirlastthreadsprofile}')."#i", '', 0);
find_replace_templatesets("member_profile", "#".preg_quote('{$signature}')."#i", '{$mybbirlastthreadsprofile}{$signature}');
}
function mybbirlastthreadsprofile_deactivate(){
global $mybb, $db;
include MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("member_profile", "#".preg_quote('{$mybbirlastthreadsprofile}')."#i", '', 0);
}
function mybbirlastthreadsprofile()
{
global $db, $mybb, $memprofile, $theme, $lang, $mybbirlastthreadsprofile, $parser;
$lang->load("mybbirlastthreadsprofile");
$threadlimit = 5;
$query = $db->query("
SELECT t.*, p.*, u.username, p.pid, p.fid, u.usergroup, u.displaygroup, f.name AS forumname
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."users u ON (p.username=u.username)
LEFT JOIN ".TABLE_PREFIX."forums f ON (p.fid=f.fid)
LEFT JOIN ".TABLE_PREFIX."threads t ON (p.tid=t.tid)
LEFT JOIN ".TABLE_PREFIX."users u
ON (p.uid=u.uid)
WHERE p.visible = '1' And p.uid = '{$memprofile['uid']}'
ORDER BY p.pid DESC, p.dateline DESC
LIMIT 0, {$threadlimit}
");
while($threads = $db->fetch_array($query))
{
$threads['subject'] = htmlspecialchars_uni($threads['subject']);
if(strlen($threads['subject']) > "40")
{
$threadsthreadsubject = my_substr($threads['subject'],0,40)."...";
}
else
{
$threadsthreadsubject = $threads['subject'];
}
if(strlen($threads['forumname']) > "20")
{
$threadsforumname = my_substr($threads['forumname'],0,20)."...";
}
else
{
$threadsforumname = $threads['forumname'];
}
$parser_options = array(
'allow_html' => 1,
'allow_mycode' => 1,
'allow_smilies' => 1,
'allow_imgcode' => 1,
'allow_videocode' => 1,
'filter_badwords' => 1,
);
$post_message = $parser->parse_message($threads['message'], $parser_options);
$emptyArray = [];
$postmessage = hidecontent_parse_tags($emptyArray, true, $post_message, true);
if(strlen($postmessage) > "300")
{
$threadreadmore = '<div class="panel-wrapper" id="item-'.$threads[pid].'" style="height: 80px;overflow: hidden;;"><p>'.$postmessage.'</p></div><div style="display: flex"><a class="readmore" href="javascript://" id="'.$threads[pid].'">Read More </a></div>';
}
else
{
$threadreadmore = '<div class="panel-wrapper" id="item-'.$threads[pid].'"><p>'.$postmessage.'</p></div>';
}
$pid = (int)$mybbirlastthreadsprofile['pid'];
$link = get_post_link($pid."#pid".$pid, $tid);
$threadlink = get_thread_link($threads['tid']);
$forumlink = get_forum_link($threads['fid']);
$replies = my_number_format($threads['replies']);
$views = my_number_format($threads['views']);
$lastpostdate = my_date($mybb->settings['dateformat'], $threads['dateline']);
$lastposttime = my_date($mybb->settings['timeformat'], $threads['dateline']);
$lastposter = format_name(htmlspecialchars_uni($threads['username']), $threads['usergroup'], $threads['displaygroup']);
$lastposter = build_profile_link($lastposter, $threads['lastposteruid']);
$last_thread .= '
<li class="timeline-item">
<div class="timeline-info">
<span><i class="fas fa-clock"></i> '.$lastposttime.' '.$lastpostdate.' <i class="fas fa-comments-alt"></i> '.$replies.' posts</span>
</div>
<div class="timeline-marker"></div>
<div class="timeline-content">
<div>
<h3 class="timeline-title"><a href="'.$link.'" title="'.$threads[threadsubject].'">'.$threadsthreadsubject.'</a></h3>
'.$threadreadmore.'
<script>
$(function(){
var $allItems = $(".panel-wrapper");
$(document.body).on("click", "a.readmore", function () {
var id = this.id, itemId = "#item-" + id;
$allItems.not($(itemId).toggleClass("active"));
});
});
</script>
<style>
.panel-wrapper.active{
height: 100% !important;
}
.readmore {
background: #2c2c2c;
padding: 5px 12px 7px;
margin-top: 10px;
color: #a4a4a4;
border-radius: 3px;
}
.readmore:hover {
background: #a92f2f;
color: #efefef;
}
</style>
</div><h4><br /> - <a href="'.$forumlink.'">'.$threads[forumname].'</a> - </h4>
</div>
</li>';
}
if(!$last_thread){
global $lang;
$lang->load("mybbirlastthreadsprofile");
$last_thread = "<div class=\"activity-split trow1\" style=\"margin: auto; float: none;padding: 25px;\">No content</div><br />";
}
global $lang;
$lang->load("mybbirlastthreadsprofile");
$mybbirlastthreadsprofile = "<div class=\"activity-split trow1\" style=\"margin: auto; float: none;padding: 25px;\"><ul class=\"timeline\"><!-- change timeline-split to timeline or timeline-centered, to change the timeline style -->{$last_thread}</ul></div><br />";
}
?>
Ah, maybe there is no need for the above plugin edit, just try this first, just use this code below, and see if that is all you need to do,
if the below simple solution does not work, then try the plugin edit I provided
<h3 class="timeline-title"><a href="'.$threads[pid].'" title="'.$threads[threadsubject].'">'.$threadsthreadsubject.'</a></h3>