2009-03-08, 12:30 PM
This plugin is intended to align the $post['message'] to right.
Now doing this replaces the "postbit" templete text and adds {$rtlo} and {$rtlc}. But the postbit_rtlo and postbit_rtlc are not created, nor are they displayed on the page.
Any pointers?
Now doing this replaces the "postbit" templete text and adds {$rtlo} and {$rtlc}. But the postbit_rtlo and postbit_rtlc are not created, nor are they displayed on the page.
Any pointers?
$plugins->add_hook('showthread_start', 'rtl_run');
function rtl_activate()
{
global $lang, $mybb, $db;
require MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets('postbit', '#'.preg_quote('{$post[\'message\']}').'#', '{$rtlo}{$post[\'message\']}{$rtlc}');
$new_template = '<div align="right">';
$new_template1 = '</div>';
$db->insert_query('templates', array(
'title' => 'postbit_rtlo',
'template' => $db->escape_string($new_template),
'sid' => -1,
'version' => 120
));
$db->insert_query('templates', array(
'title' => 'postbit_rtlc',
'template' => $db->escape_string($new_template1),
'sid' => -1,
'version' => 120
));
}
function rtl_deactivate()
{
require MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("postbit", '#{\$rtlo}#', '', 0);
find_replace_templatesets("postbit", '#{\$rtlc}#', '', 0);
global $db;
$db->delete_query('templates', 'title = "postbit_rtlo"');
$db->delete_query('templates', 'title = "postbit_rtlc"');
}
function rtl_run()
{
global $lang, $templates, $db, $rtl, $mybb;
eval('$rtlo = "'.$templates->get('postbit_rtlo').'";');
eval('$rtlc = "'.$templates->get('postbit_rtlc').'";');
}