MyBB Community Forums

Full Version: Display one post on single page?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've been working on integrating my forum with my site and everything has gone pretty well, but now I want to do something that I'm not sure is possible.

There's a specific post on my forum that I want to integrate into a separate page on my website. I want to maintain the paragraph formatting, as I don't want it to look like garbage text.

Is this possible?
If i understand your question correctly, this is possible. Just use the following as a base for your page:

<?php
define("IN_MYBB",1);
require("./forum/global.php");

//CHANGE THIS\\
$tid = 1; //This should be the id of your thread

$query = $db->simple_select("threads","*","tid={$tid}");
$a = $db->fetch_array($query);
$getPost = $db->simple_select("posts","*","pid={$a['firstpost']}");
$p = $db->fetch_array($getPost);
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;
$parser_options['allow_html'] = 0;
$parser_options['allow_mycode'] = 1;
$parser_options['allow_smilies'] = 1;
$parser_options['allow_imgcode'] = 1;
$parser_options['allow_videocode'] = 1;
$parser_options['me_username'] = $a['username'];
$parser_options['filter_badwords'] = 1;
$p['message'] = $parser->parse_message($p['message'], $parser_options);
$a['postdate'] = my_date($mybb->settings['dateformat'], $a['articledate']);
$a['posttime'] = my_date($mybb->settings['timeformat'], $a['articledate']);
$postdate = $a['postdate'].", ".$a['posttime'];
?>

You'll need to modify it a bit (such as make it echo the message, which will already be formatted with MyCode, etc. by echoing '$p['message']')

Hope that helps!
Thank you for the response!

Exactly what I needed Smile