Phew -- trader mod completed.
I'm now trying to figure out how to display the rating next to each username in viewtopic.php
Right after around line 200:
if ($cur_post['poster_id'] > 1) {
I added my code which retrieves the rating for the individual user and adds up all the rows using a $db->num_rows statement. I can't figure out why only one post is ever displayed when the db is queried within the squiggly bracket.
It seems like a database query resets the counter for the loop around all posts.
My modified code within viewtopic.php
// If the poster is a registered user.
if ($cur_post['poster_id'] > 1)
{
//
// show trader feedback
//
$number_of_ratings=0;
// get total feedback for user and display it
$result = $db->query('SELECT trade_ref FROM '.$db->prefix.'traderfeedback WHERE id='.$cur_post['poster_id']) or error('Unable to fetch feedback', __FILE__, __LINE__, $db->error());
$number_of_ratings=$db->num_rows($result);
$feedback="Trader Rating (<a href='trader.php?action=view&id=".$cur_post['poster_id']."'>".$number_of_ratings."</a>)";
//
// end trader feedback
//
$username = '<a href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['username']).'</a>';
$user_title = get_title($cur_post);