Skip to Content
 

Game Journal

7 replies [Last post]
pastej
Offline
Joined: 08/12/2008

Hi!

I have created a game journal for my game Space Zoo. It doesn't seem to be linked to my user page. What have I done wrong?

Best regards, Erik

questccg
questccg's picture
Offline
Joined: 04/16/2011
Game Journals

They can be "viewed" from top link "Game Journals"... They are not linked to your user account. Only BLOGS are linked...

That's why I blog rather than post "Game Journals".

FYI.

pastej
Offline
Joined: 08/12/2008
Bug?

Thank you for answering!

On my user page to the left it is written that "No game journals created" (as is the same for your user page). This is not true. Is this a known feature of the site?

Best regards,
Erik

questccg
questccg's picture
Offline
Joined: 04/16/2011
Send a PM to...

richdurham

He might be able to help - if it's a bug.

richdurham
richdurham's picture
Offline
Joined: 12/26/2009
looking in to it.

I'm looking in to it, and forwarding the request to our more drupal oriented admin. In the mean time, if anyone here knows PHP code and can see something wrong with this without knowing whether the references are right (eg. to the node.type of "gamejournal" which is correct) then let me know and I can implement:

```

<?php
/**
* Creates a quicklist of recent game journals and a link to their
* node.
*
* To increase the length of the list, change $listlength
*
*/
global $user;
global $node;
$listlength="20";

preg_match("/\/user\/([0-9]*).*$/", request_uri(), $matches);
$tempuid = $matches[1];

$sql = "SELECT node.nid, node.title, node.created, users.name, node.uid FROM node INNER JOIN users WHERE node.uid = $tempuid  AND users.uid=$tempuid AND node.status = 1 AND (node.type='gamejournal') ORDER BY name DESC LIMIT 10";
$numrows = 0;
$result = db_query($sql);
$output .= "<table><tbody>";
while ($sqlnode = db_fetch_object($result)) {
$year = format_date($sqlnode->created, 'custom', 'Y');
$month_day = format_date($sqlnode->created, 'custom', 'M j');
  if ($year != $prev_year) {
    $output .= "</tbody></table><h3>$year</h3><table><tbody>"; 
    $prev_year = $year;
  }
$output .= "<tr><td>". $month_day . "&nbsp;" . "</td><td>" . l($sqlnode->title, "node/$sqlnode->nid") . "&nbsp;"; 
  $output .= "</td><td><em>Submitted by " . $sqlnode->name . "</em><br/></td>";
  $numrows++;
}
$output .= "</tbody></table>";

if (0 == $numrows)
{
$output = "<table><tr><td>No game journals created.</td></tr></table>";
}

print $output;
?>

```

questccg
questccg's picture
Offline
Joined: 04/16/2011
Hmm...

It's obvious the code returns NO RECORDS, because the while-loop would increment then $numrows by 1. So it's got to be something with the SQL.

Looking at the SQL, I can see nothing blatantly wrong, but some things that should be checked.

  • node.status = 1? Is this true???
  • (node.type='gamejournal')? Could it be 'Game Journal' or 'game journal'??? All lower case with a SPACE?!?!

That's the two (2) places I would look first.

Cheers!

Tbone
Tbone's picture
Offline
Joined: 02/18/2013
PHP student

I am currently learning PHP for school. My only question would be why you have a curly braket after the first if has already been closed. Unless there is supposed to be an else statement? Not sure. My bet is that some how your $ numrows variable is getting past the loop and going straight to the last if statement.

Again I'm a sstudent so I could be talking complete nonsense. Lol.

***edit***
answered my own question. I forgot the while loop braces. Whoops.

richdurham
richdurham's picture
Offline
Joined: 12/26/2009
Not the node.type

Thanks for the look-through, guys. Questccg - the node.type being "gamejournal" all lowercase like that with one word is indeed the machine-readable name stored for that node. I'll try wiggling the node.status to see if that makes a difference.

Short is, this code is when a user looks at their personal profile, they see a block on the left about their game journals. The code retrieves the journals they've created and lists them. That's it.

If none were created, it says so ($numrows == 0)

But it doesn't seem to be working.

Syndicate content


forum | by Dr. Radut