PDA

View Full Version : Need help with this


CPTA
07-20-2011, 08:28 AM
My last post area, i wanted to make it show the persons username in the same color as their designated usergroup color.

When i use the modification it ++++s up and does this..
http://imageshack.us/photo/my-images/97/screenshot20110720at139.png/
Look at the picture and you will notice it will show the username twice EG: CPTA is offline"> CPTA

How would i fix this, the xml code looks like this.



<?xml version="1.0" encoding="ISO-8859-1"?>

<product productid="color_pseudo" active="1">
<title>Usernames color</title>
<description><![CDATA[This hack allows you to display usernames with color on your forum.]]></description>
<version>1.1</version>
<url />
<versioncheckurl />
<dependencies>
</dependencies>
<codes>
</codes>
<templates>
</templates>
<plugins>
<plugin active="1" executionorder="5">
<title>Couleur des Pseudo</title>
<hookname>colorname</hookname>
<phpcode><![CDATA[global $db;

$forumid = $lastpostinfo['forumid'];
$idpost = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "forum WHERE forumid='$forumid'");
$postid = $idpost['lastpostid'];
$select = $db->query_first("
SELECT * FROM " . TABLE_PREFIX . "user as u
LEFT JOIN " . TABLE_PREFIX . "usergroup as ug ON (u.usergroupid = ug.usergroupid)
LEFT JOIN " . TABLE_PREFIX . "post as p ON (u.userid = p.userid)
WHERE postid='$postid'
");

$lastpostinfo['lastposter'] = $select['opentag'].$lastpostinfo['lastposter'].$select['closetag'];]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>Couleur des Pseudo</title>
<hookname>threadbit_display</hookname>
<phpcode><![CDATA[$select = $db->query_first("
SELECT * FROM " . TABLE_PREFIX . "user as u
LEFT JOIN " . TABLE_PREFIX . "usergroup as ug ON (u.usergroupid = ug.usergroupid)
LEFT JOIN " . TABLE_PREFIX . "post as p ON (u.userid = p.userid)
WHERE postid=$thread[lastpostid]
");

$thread['lastposter'] = $select['opentag'].$thread['lastposter'].$select['closetag'];]]></phpcode>
</plugin>
</plugins>
<phrases>
</phrases>
<options>
</options>
<helptopics>
</helptopics>
<cronentries>
</cronentries>
<faqentries>
</faqentries>
</product>

kh99
07-20-2011, 10:38 AM
Questions about mods should be asked in the mod thread, and you shouldn't post the entire code for a mod. Also you should also use code tags.

That said, the problem is that the mod changes $lastpostinfo['lastposter'] which is not just used to display the name. You would probably need to change the code to something like:

$lastpostinfo['lastpostercolor'] = $select['opentag'].$lastpostinfo['lastposter'].$select['closetag'];


then find the place in the template where lastposter is used to display the name, and change it to lastpostercolor.