*

Recent

Author Topic: comment by "no one" ?  (Read 4253 times)

Sterling

  • Jr. Member
  • **
  • Posts: 81
  • Force: +1/-0
    • Hitchhike games
comment by "no one" ?
« on: April 17, 2009, 03:41:50 PM »
Hey everyone,
   I was thinking it would be better if someone comments a game without logging in and it says "Posted By:(Unknown or Guest)" ??? or something like that instead of it being blank!!!  If someone could fix that it would be most appreciated :)

      Thanks in Advance

kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: comment by "no one" ?
« Reply #1 on: April 17, 2009, 05:24:29 PM »
I will try and look into that this weekend. I suspect though that most people would rather not even allow guests to post comments at all rather than just mark them as guest. No promises but let me look it over though and see what comes of it.

kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: comment by "no one" ?
« Reply #2 on: April 17, 2009, 08:20:39 PM »
OK, I have  NOT tested this kinda backed up right now,but open the file /pages/play.php and find up near the top where it reads

Code: [Select]

$r = $db->fetch_row($ir);
if(isset($_POST['commentsubmit'])){
$commenter = $usrdata['userid'];
      $gameid = $ID;
$comment = clean($_POST['comment']);
$date = time();
if($autoapprovecomments == 1){
$approved = 1;


and insert a line to make it read

Code: [Select]

$r = $db->fetch_row($ir);
if(isset($_POST['commentsubmit'])){
$commenter = $usrdata['userid'];
      if ($commenter == '') { $commenter = 'Guest';};
$gameid = $ID;
$comment = clean($_POST['comment']);
$date = time();
if($autoapprovecomments == 1){
$approved = 1;



Try that and let me know if that does what you want it to do.
« Last Edit: April 17, 2009, 08:22:38 PM by kurt »

Danny

  • Newbie
  • *
  • Posts: 41
  • Force: +5/-0
Re: comment by "no one" ?
« Reply #3 on: April 18, 2009, 05:36:39 PM »
^^ won't work - the commenter is a ID (of the poster).

You could create a new user, under the name "guest" or what not. Get the ID, and do the same as above, however replace the text with the ID.

Though, if you do not want to do it that way, were it displays the commenter name, use the if/else see if it's empty, print out the guest text.

kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: comment by "no one" ?
« Reply #4 on: April 19, 2009, 04:03:48 PM »
Thanks for pointing that out Danny. Unfortunatly I have not had time to try this on a live site, sooooooo backup your pages/play.php file first.

Open the file up and find the code somewhere a bit farther down then halfway:

Code: [Select]

$rra = $db->fetch_row($db->query(sprintf('SELECT username FROM dd_users WHERE userid=\'%u\'', $row['commenter'])));

echo ' <tr>
<td width=\'30%\' class=\'content5\' style=\'padding:4px;\' valign=\'top\'><b>Posted By:</b> '.$rra['username'].'</td>
<td valig=\'top\' class=\'content5\'>'.$row['comment'].'</td>


And edit it to look like this:
Code: [Select]

$rra = $db->fetch_row($db->query(sprintf('SELECT username FROM dd_users WHERE userid=\'%u\'', $row['commenter'])));
            if ( $row['commenter'] == '0' ) {$commenter='Guest';} else {$commenter=$rra['username'];};
echo ' <tr>
<td width=\'30%\' class=\'content5\' style=\'padding:4px;\' valign=\'top\'><b>Posted By:</b> '.$commenter.'</td>
<td valig=\'top\' class=\'content5\'>'.$row['comment'].'</td>


Not having time to try it on a site that has much in the way of comments I won't promise it will do the trick, but I think it will.

Sorry, been a bit tied up with working on getting a new release ready. Expect it in a couple

Sterling

  • Jr. Member
  • **
  • Posts: 81
  • Force: +1/-0
    • Hitchhike games
Re: comment by "no one" ?
« Reply #5 on: April 21, 2009, 09:54:38 PM »
Thanks for all your help guys...I really appreciate i!!! ;D