Advertisement:

Author Topic: [SOLVED] Really need comments on user's profile page!  (Read 1380 times)

astroboy

  • Newbie
  • *
  • Posts: 46
[SOLVED] Really need comments on user's profile page!
« on: August 26, 2012, 11:58:32 am »
Please is there anyway to get the comments function onto the users profile page or at least display any comments a user has had on their items?

I have tried and tried but, just cannot figure it out!

Any help would be great!!
« Last Edit: August 26, 2012, 04:08:09 pm by astroboy »

astroboy

  • Newbie
  • *
  • Posts: 46
Re: Really need comments on user's profile page!
« Reply #1 on: August 26, 2012, 03:51:50 pm »
Did it!

Not the best way, it's dirty but, it works.

The following code will add all comments from all listings made on a user. Fits nicely under the user's details on the user-public-profile.php page.

Code: [Select]
                <?php
$con mysql_connect("localhost","your_db_username","your_db_password");
if (!$con)
  {
  die('Could not connect: ' mysql_error());
  }

mysql_select_db("your_db_database"$con);

$userid osc_user_id();

                
$result mysql_query("SELECT oc_t_item.fk_i_user_id, oc_t_item_comment.dt_pub_date, s_title, s_author_name, s_body FROM oc_t_item JOIN oc_t_item_comment ON oc_t_item_comment.fk_i_item_id = oc_t_item.pk_i_id WHERE oc_t_item.fk_i_user_id = $userid AND oc_t_item_comment.b_enabled = 1 AND oc_t_item_comment.b_active = 1");

while($row mysql_fetch_array($result))
  {
  echo "<span style=\"font-size:18px; color:#333;\">".$row['s_title']."</span> <span style=\"font-style:italic; font-size:12px; color:#666;\">by ".$row['s_author_name']."</span>";
  echo "<br /><span style=\"font-style:italic; font-size:12px; color:#666;\">";
  echo $row['s_body'];
  echo "</span><br /><br />";
  echo "<br />";
  echo "<div style=\"border-bottom: 1px solid rgb(221, 221, 221);\"></div>";
  echo "<br />";
  }
mysql_close($con);
?>