2017-10-21, 01:26 PM
Hi everyone,
I have a modification on my forum so that the user who created a thread or post that is not yet approved can still see it.
I would like to know if there is a hook or way to turn this into a plugin so I can remove the core modifications to make it easier for when I have to update the forums.
-- WARNING: THE BELOW CHANGES ARE BASED OF MyBB 1.8.7 AND MAY REQUIRE CHANGES TO WORK WITH THE LATEST VERSION!! --
The modifications are as follow, for the showthread.php:
After
Add
And change:
To:
And on the forumdisplay.php, the modifications are as follow:
Change the following lines:
To:
So again, my question is:
I would like if there is a hook or way to turn this into a plugin?
Thanks in advance for any reply.
I have a modification on my forum so that the user who created a thread or post that is not yet approved can still see it.
I would like to know if there is a hook or way to turn this into a plugin so I can remove the core modifications to make it easier for when I have to update the forums.
-- WARNING: THE BELOW CHANGES ARE BASED OF MyBB 1.8.7 AND MAY REQUIRE CHANGES TO WORK WITH THE LATEST VERSION!! --
The modifications are as follow, for the showthread.php:
After
elseif($ismod && is_moderator($fid, "canviewdeleted") == true && is_moderator($fid, "canviewunapprove") == true)
{
$visible = "AND p.visible IN (-1,0,1)";
}
Add
elseif($mybb->user['uid'] == $thread['uid'])
{
$visible = "AND p.visible IN (0,1)";
}
And change:
$visibleonly = "AND visible=1";
To:
$visibleonly = "AND ((uid = " . intval($mybb->user['uid']) . " AND visible IN (0,1)) OR visible=1)";
And on the forumdisplay.php, the modifications are as follow:
Change the following lines:
$visibleonly = "AND visible='1'";
$tvisibleonly = "AND t.visible='1'";
To:
$visibleonly = 'AND ((uid = ' . intval($mybb->user['uid']) . ' AND visible IN (0,1)) OR visible = 1)';
$tvisibleonly = 'AND ((t.uid = ' . intval($mybb->user['uid']) . ' AND t.visible IN (0,1)) OR t.visible = 1)';
So again, my question is:
I would like if there is a hook or way to turn this into a plugin?
Thanks in advance for any reply.