You will need to hijack the quote, search, and cache system. Have you found specific troubles doing so?
(2018-12-06, 03:25 AM)Omar G. Wrote: [ -> ]You will need to hijack the quote, search, and cache system. Have you found specific troubles doing so?
Its more like I don't know where to start...
You want to hide or anonymize all last post links or specific links?
(2020-05-23, 02:18 AM)Omar G. Wrote: [ -> ]You want to hide or anonymize all last post links or specific links?
hi Omar just change the username to Anonymoose if the thread is posted as Anonymoose
also i notice in thread review it shows the username of the user that posted annonymously as well
so i try to hook newreply_threadreview_post with the following
$plugins->add_hook("newreply_threadreview_post", "thread_review");
function thread_review()
{
global $mybb, $db, $templates;
require_once "./global.php";
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;
$tid = $mybb->get_input('tid', MyBB::INPUT_INT);
$thread = get_thread($tid);
$fid = (int)$thread['fid'];
// Get forum info
$forum = get_forum($fid);
if(!$mybb->settings['postsperpage'] || (int)$mybb->settings['postsperpage'] < 1)
{
$mybb->settings['postsperpage'] = 20;
}
if(is_moderator($fid, "canviewunapprove") || $mybb->settings['showownunapproved'])
{
$visibility = "(visible='1' OR visible='0')";
}
else
{
$visibility = "visible='1'";
}
$query = $db->simple_select("posts", "COUNT(pid) AS post_count", "tid='{$tid}' AND {$visibility}");
$numposts = $db->fetch_field($query, "post_count");
if(!$mybb->settings['postsperpage'] || (int)$mybb->settings['postsperpage'] < 1)
{
$mybb->settings['postsperpage'] = 20;
}
if($numposts > $mybb->settings['postsperpage'])
{
$numposts = $mybb->settings['postsperpage'];
$lang->thread_review_more = $lang->sprintf($lang->thread_review_more, $mybb->settings['postsperpage'], get_thread_link($tid));
eval("\$reviewmore = \"".$templates->get("newreply_threadreview_more")."\";");
}
$query = $db->simple_select("posts", "pid", "tid='{$tid}' AND {$visibility}", array("order_by" => "dateline", "order_dir" => "desc", "limit" => $mybb->settings['postsperpage']));
while($post = $db->fetch_array($query))
{
$pidin[] = $post['pid'];
}
$pidin = implode(",", $pidin);
// Fetch attachments
$query = $db->simple_select("attachments", "*", "pid IN ($pidin)");
while($attachment = $db->fetch_array($query))
{
$attachcache[$attachment['pid']][$attachment['aid']] = $attachment;
}
$query = $db->query("
SELECT p.*, u.username AS userusername
FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."users u ON (p.uid=u.uid)
WHERE pid IN ($pidin)
ORDER BY dateline DESC
");
$postsdone = 0;
$altbg = "trow1";
$reviewbits = '';
while($post = $db->fetch_array($query))
{
if($post['userusername'])
{
$post['username'] = $post['userusername'];
}
$reviewpostdate = my_date('relative', $post['dateline']);
$parser_options = array(
"allow_html" => $forum['allowhtml'],
"allow_mycode" => $forum['allowmycode'],
"allow_smilies" => $forum['allowsmilies'],
"allow_imgcode" => $forum['allowimgcode'],
"allow_videocode" => $forum['allowvideocode'],
"me_username" => $post['username'],
"filter_badwords" => 1
);
if($post['smilieoff'] == 1)
{
$parser_options['allow_smilies'] = 0;
}
if($mybb->user['showimages'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestimages'] != 1 && $mybb->user['uid'] == 0)
{
$parser_options['allow_imgcode'] = 0;
}
if($mybb->user['showvideos'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestvideos'] != 1 && $mybb->user['uid'] == 0)
{
$parser_options['allow_videocode'] = 0;
}
$post['username'] = htmlspecialchars_uni($post['username']);
if($post['visible'] != 1)
{
$altbg = "trow_shaded";
}
/*//////////////////////////////////////////////////////////// change username to Anonymoose ///////////////////////////////////////////////*/
if($post['optanon_posted'])
{
$post['username'] = 'Anonymoose';
}
/*//////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////*/
$post['message'] = $parser->parse_message($post['message'], $parser_options);
get_post_attachments($post['pid'], $post);
$reviewmessage = $post['message'];
eval("\$reviewbits .= \"".$templates->get("newreply_threadreview_post")."\";");
if($altbg == "trow1")
{
$altbg = "trow2";
}
else
{
$altbg = "trow1";
}
}
eval("\$threadreview = \"".$templates->get("newreply_threadreview")."\";");
}
but still shows the username not Anonymoose
(2020-05-23, 03:01 AM)8guawong Wrote: [ -> ]hi Omar just change the username to Anonymoose if the thread is posted as Anonymoose
But how do you know if a post was posted as "anonymoose"? Is that a post field? You basically just need to hook to
build_forumbits_forum
and create your own last post variable replacing the core one (I thought you could hijack the cache but apparently not all last post data is got from the cache).
Quote:also i notice in thread review it shows the username of the user that posted annonymously as well
$plugins->add_hook("newreply_threadreview_post", "thread_review");
function thread_review()
{
global $post, $lang;
$post['username'] = htmlspecialchars_uni($lang->whatever);
}
(2020-05-23, 03:51 AM)Omar G. Wrote: [ -> ]But how do you know if a post was posted as "anonymoose"? Is that a post field? You basically just need to hook to build_forumbits_forum
and create your own last post variable replacing the core one (I thought you could hijack the cache but apparently not all last post data is got from the cache).
ok i'll try some more
(2020-05-23, 03:51 AM)Omar G. Wrote: [ -> ]$plugins->add_hook("newreply_threadreview_post", "thread_review");
function thread_review()
{
global $post, $lang;
$post['username'] = htmlspecialchars_uni($lang->whatever);
}
thx
Thanks Omar for your help!
I think I've got the forumbit part
here is the post
could you check to see if you can find out who posted it?
Nvm I found some stuff that needs to be fixed