2009-04-25, 09:09 PM
Hey everyone,
I recently installed a plugin allowing me to have the traditional author column displayed in the forumtopics page. However, when it displays the name of a user that has a custom username markup as defined in the Admin Panel, it doesn't apply to this column, it shows it like everyone else's. My question is: How can I make it to where the authors name has the username markups included if the group has one?
This is the code, I've altered it a couple of times and still got no result, so I am posting the original.
Thanks!
I recently installed a plugin allowing me to have the traditional author column displayed in the forumtopics page. However, when it displays the name of a user that has a custom username markup as defined in the Admin Panel, it doesn't apply to this column, it shows it like everyone else's. My question is: How can I make it to where the authors name has the username markups included if the group has one?
This is the code, I've altered it a couple of times and still got no result, so I am posting the original.
<?php
/**
* MyBB 1.4 Classic Author Column 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.");
}
//Thanks to Demonic for this function
//http://community.mybboard.net/thread-39634.html
function classicauthorcolumn_temp_uninstall($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 classicauthorcolumn_info()
{
return array(
"name" => "Classic Author Column",
"description" => "Classic Author Column in forumdisplay threads",
"website" => "",
"author" => "ELY M.",
"authorsite" => "",
"version" => "1.0.4",
"guid" => "ce93d53806d0037002a070fd9fdd8a9b",
"compatibility" => "14*"
);
}
function classicauthorcolumn_activate()
{
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("forumdisplay_threadlist", "#".preg_quote("{\$colspan}")."#i", "9");
find_replace_templatesets("forumdisplay_threadlist", "#".preg_quote("{\$colspan}")."#i", "9");
find_replace_templatesets("forumdisplay_thread", "#".preg_quote("<div class=\"author smalltext\">{\$thread['profilelink']}</div>")."#i", "<!-- authornamewashere -->");
find_replace_templatesets("forumdisplay_threadlist", "#".preg_quote("<td class=\"tcat\" colspan=\"3\" width=\"66%\"><span class=\"smalltext\"><strong><a href=\"{\$sorturl}&sortby=subject&order=asc\">{\$lang->thread}</a> {\$orderarrow['subject']} / <a href=\"{\$sorturl}&sortby=starter&order=asc\">{\$lang->author}</a> {\$orderarrow['starter']}</strong></span></td>")."#i", "<td class=\"tcat\" align=\"center\" colspan=\"3\" width=\"66%\"><span class=\"smalltext\"><strong><a href=\"{\$sorturl}&sortby=subject&order=asc\">{\$lang->thread}</a> {\$orderarrow['subject']}</strong></span></td>");
find_replace_templatesets("forumdisplay_thread", "#".preg_quote("<td align=\"center\" class=\"{\$bgcolor}\"><a href=\"javascript:MyBB.whoPosted({\$thread['tid']});\">")."#i", "<td align=\"center\" class=\"{\$bgcolor}\">{\$thread['profilelink']}</td> <td align=\"center\" class=\"{\$bgcolor}\"><a href=\"javascript:MyBB.whoPosted({\$thread['tid']});\">");
find_replace_templatesets("forumdisplay_threadlist", "#".preg_quote("<td class=\"tcat\" align=\"center\" width=\"7%\"><span class=\"smalltext\"><strong><a href=\"{\$sorturl}&sortby=replies&order=desc\">{\$lang->replies}</a>")."#i", "<td class=\"tcat\" align=\"center\" width=\"10%\"><span class=\"smalltext\"><strong><a href=\"{\$sorturl}&sortby=starter&order=asc\">{\$lang->author}</a> {\$orderarrow['starter']}</strong></span></td> <td class=\"tcat\" align=\"center\" width=\"7%\"><span class=\"smalltext\"><strong><a href=\"{\$sorturl}&sortby=replies&order=desc\">{\$lang->replies}</a>");
}
function classicauthorcolumn_deactivate()
{
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
classicauthorcolumn_temp_uninstall("forumdisplay_threadlist", "#".preg_quote("9")."#i", "{\$colspan}");
classicauthorcolumn_temp_uninstall("forumdisplay_threadlist", "#".preg_quote("9")."#i", "{\$colspan}");
classicauthorcolumn_temp_uninstall("forumdisplay_thread", "#".preg_quote("<!-- authornamewashere -->")."#i", "<div class=\"author smalltext\">{\$thread['profilelink']}</div>");
classicauthorcolumn_temp_uninstall("forumdisplay_threadlist", "#".preg_quote("<td class=\"tcat\" align=\"center\" colspan=\"3\" width=\"66%\"><span class=\"smalltext\"><strong><a href=\"{\$sorturl}&sortby=subject&order=asc\">{\$lang->thread}</a> {\$orderarrow['subject']} {\$orderarrow['starter']}</strong></span></td>")."#i", "<td class=\"tcat\" colspan=\"3\" width=\"66%\"><span class=\"smalltext\"><strong><a href=\"{\$sorturl}&sortby=subject&order=asc\">{\$lang->thread}</a> {\$orderarrow['subject']} / <a href=\"{\$sorturl}&sortby=starter&order=asc\">{\$lang->author}</a> {\$orderarrow['starter']}</strong></span></td>");
classicauthorcolumn_temp_uninstall("forumdisplay_thread", "#".preg_quote("<td align=\"center\" class=\"{\$bgcolor}\">{\$thread['profilelink']}</td> <td align=\"center\" class=\"{\$bgcolor}\"><a href=\"javascript:MyBB.whoPosted({\$thread['tid']});\">")."#i", "<td align=\"center\" class=\"{\$bgcolor}\"><a href=\"javascript:MyBB.whoPosted({\$thread['tid']});\">");
classicauthorcolumn_temp_uninstall("forumdisplay_threadlist", "#".preg_quote("<td class=\"tcat\" align=\"center\" width=\"10%\"><span class=\"smalltext\"><strong><a href=\"{\$sorturl}&sortby=starter&order=asc\">{\$lang->author}</a> {\$orderarrow['starter']}</strong></span></td> <td class=\"tcat\" align=\"center\" width=\"7%\"><span class=\"smalltext\"><strong><a href=\"{\$sorturl}&sortby=replies&order=desc\">{\$lang->replies}</a>")."#i", "<td class=\"tcat\" align=\"center\" width=\"7%\"><span class=\"smalltext\"><strong><a href=\"{\$sorturl}&sortby=replies&order=desc\">{\$lang->replies}</a>");
}
?>
Thanks!