MyBB Community Forums

Full Version: Removing Postbit from Announcements
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Okay, thanks everyone for your help thus far. Its embarrassing how little I know about PHP, but I'm learning (slowly and surely ..slowly) Toungue.

With the PHP you guys helped me with, I'm almost done with this plugin (all the backend components are 100%). I do have one more question, however.

With my new announcements.php page, only text will show up from the contents of the announcements. I would also like the MyCode to be active as well as HTML to be working on these announcements. How do I get these items enabled on the following page?

PHP Code:
<?php
define
("IN_MYBB"1);
require 
'./global.php';
require_once 
MYBB_ROOT.'inc/class_parser.php';
$parser = new postParser;

$aid intval($mybb->input['aid']);
$ann $db->fetch_array($db->simple_select('announcements''*''aid='.$aid));
if(!
$ann)
error('Invalid announcement'); // use the correct langvar here if you wish

// set the parser options here appropriately
$options = array();
$message $parser->parse_message($ann['message'], $options);

echo 
$message;
?>

Thanks again, I really appreciate it! Smile
Find:

PHP Code:
$options = array(); 

Replace with:

PHP Code:
$options = array(
    
'allow_html'    => $ann['allowhtml'],
    
'allow_mycode'  => $ann['allowmycode'],
    
'allow_smilies' => $ann['allowsmilies'],
    
'allow_imgcode' => 1,
); 

That code will use the options you set when you created the announcement. If you want to override an option, just replace the $ann['...'] variable with 1 or 0.
(08-23-2008 01:35 AM)WDZ Wrote: [ -> ]Find:

PHP Code:
$options = array(); 

Replace with:

PHP Code:
$options = array(
    
'allow_html'    => $ann['allowhtml'],
    
'allow_mycode'  => $ann['allowmycode'],
    
'allow_smilies' => $ann['allowsmilies'],
    
'allow_imgcode' => 1,
); 

That code will use the options you set when you created the announcement. If you want to override an option, just replace the $ann['...'] variable with 1 or 0.
Thank you so much, it works great.
Pages: 1 2
Reference URL's