2009-02-10, 05:37 PM
Im trying to get my plugin to work.
I already have {$lastpost_icon} in my template forumbit_depth2_forum_lastpost
to test and try to get this plugin to work.
you need to manually add {$lastpost_icon} into forumbit_depth2_forum_lastpost template
any help would be appreciated.
this is original mod that I'm trying to convert to a plugin.
http://community.mybboard.net/thread-32146.html
credit to LeX- for original mod.
<?php
/**
* MyBB 1.4 Post Icons on index in lastpost Plugin
* by ELY M.
*
*/
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("build_forumbits_forum", "posticonsonindex_start");
/*
//Thanks to Demonic for this function
//http://community.mybboard.net/thread-39634.html
function posticonsonindex_uninstalltemplates($title,$find,$replace) {
global $db;
$title = $db->escape_string( $title );
$query = $db->simple_select("templates", "*", "title='$title' AND sid='-2'");
if( $db->num_rows( $query ) > 0 ) {
$rows = $db->fetch_array( $query );
$temp = str_replace($find,$replace, $rows['template']);
$updatetemp = array("template" => $db->escape_string($temp), "dateline" => TIME_NOW);
$db->update_query("templates", $updatetemp, "title='$title'");
}
}
*/
function posticonsonindex_info()
{
return array(
"name" => "Post icons on index in the last post",
"description" => "Post icons on index in the last post next to thread subject",
"website" => "",
"author" => "ELY M.",
"authorsite" => "",
"version" => "1.0.1",
"guid" => "",
"compatibility" => "14*"
);
}
/*
function posticonsonindex_activate()
{
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
//find_replace_templatesets("nav_sep", "#/#i", "»");
//find_replace_templatesets("nav_sep_active", "#/#i", "<br><img src=images/nav_bit.gif>");
}
function posticonsonindex_deactivate()
{
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
//replace_temp_set("nav_sep", "#".preg_quote("»")."#i", "/");
//replace_temp_set("nav_sep_active", "#".preg_quote("<br><img src=images/nav_bit.gif>")."#i", "/");
}
*/
function posticonsonindex_start() {
global $fcache, $cache, $moderatorcache, $forumpermissions, $theme, $mybb, $templates, $bgcolor, $collapsed, $lang, $showdepth, $plugins, $parser, $forum_viewers;
// GET THREAD ICON
$lastpost_icon = "";
$thread = get_thread($lastpost_data['lastposttid']);
$icon_cache = $cache->read("posticons");
if($thread['icon'] > 0 && $icon_cache[$thread['icon']])
{
$icon = $icon_cache[$thread['icon']];
$lastpost_icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" /> ";
}
}
?>
I already have {$lastpost_icon} in my template forumbit_depth2_forum_lastpost
to test and try to get this plugin to work.
you need to manually add {$lastpost_icon} into forumbit_depth2_forum_lastpost template
any help would be appreciated.
this is original mod that I'm trying to convert to a plugin.
http://community.mybboard.net/thread-32146.html
credit to LeX- for original mod.