There are two code snippets below from this module. The first is the original, where the database is hard coded into the path. the second uses (what I think is) the corrected relative path.
The error I get is
Unknown table 'og' in where clause query: SELECT e.nid FROM test_event e INNER JOIN test_node n ON e.nid = n.nid INNER JOIN test_node_access na ON na.nid = e.nid INNER JOIN test_og on og.nid = na.gid WHERE og.nid = 102 in /sitepathl/includes/database.mysql.inc on line 120.
Obviously my database structure uses "test_" as the prefix
// View only events from this group
$result = db_query("SELECT e.nid FROM {event} e INNER JOIN {node} n ON e.nid = n.nid INNER JOIN {node_access} na ON na.nid = e.nid INNER JOIN {og} on og.nid = na.gid WHERE og.nid = %d", $gid);
while ($nid = db_fetch_object($result)) {
$event = node_load($nid->nid);
if (isset($event->nid)) {
$nodes[$event->nid] = $event;
This at least returns no errors and the calendar as expected.
// View only events from this group
$result = db_query("SELECT e.nid FROM {event} e INNER JOIN {node} n ON e.nid = n.nid INNER JOIN {node_access} na ON na.nid = e.nid INNER JOIN {og} on {og}.nid = na.gid WHERE {og}.nid = %d", $gid);
while ($nid = db_fetch_object($result)) {
$event = node_load($nid->nid);
if (isset($event->nid)) {
$nodes[$event->nid] = $event;
}
I have attached the corrected file, or at least what I think is the corrected file.
Cheers,
Craig
| Comment | File | Size | Author |
|---|---|---|---|
| og_calendar.module | 3.42 KB | Chaos_Zeus |
Comments
Comment #1
webchickD'oh! What a silly mistake. Thanks for the heads up. :)
Just FYI, the way I fixed it was to call the table thusly:
INNER JOIN {og} og
So later references to og.something will work.
Please advise if you have any other problems!
Comment #2
(not verified) commented