I've set up a 4.5.2 site and installed the Event module; I display the "Upcoming Events" block on the left side.

Everything is fine if the user is logged in. But for the anonymous user, each event displays 3 times in the Upcoming Events block. I'm using the module in several Drupal 4.5.2 sites, and this one is the only one with the problem.

I suspect (but haven't been able to prove) that there's interaction between the modules installed, since this site has unusually many active. Before I go through the standard "deactivate half, then swap" approach to see if this is the case, I figured I'd ask if anyone has seen this problem, and how they solved. it.

Thanks,
Rob Thorne
Torenware Networks

Comments

Torenware’s picture

Any advice how best to debug this? I'm especially looking for a good way to get a "stack trace", since while I don't know who's calling the Event block code 3x, I at least know what code they're calling.

Thanks,
Rob

Rob Thorne
Torenware Networks

Torenware’s picture

I tried installing the TWM-logger package (http://threewisemen.ca/twm-logger.jsp), and probably learned something a bit annoying: it looks like event.module is eval'd, so as far as the stack trace is concerned, that's as far as it goes.

Where is a better place in the code to listen? I'm guessing that I want to listen on the side that calls the hook, rather than on the other side.

Thanks,
Rob

Rob Thorne
Torenware Networks

Torenware’s picture

OK, last try. If I am logged in as the admin, here is the SQL generated to get the events (I've added a little formatting to make it easier to read):

SELECT n.nid, n.title, n.status, n.moderate, e.* FROM node n  
INNER JOIN event e ON n.nid = e.nid 
WHERE n.type='event' AND '1' AND n.status = 1 AND e.start >= 1111361161 
ORDER BY e.start LIMIT 0, 6

But here is the SQL generated for a simple authenticated user, or an unauthenticated user (both cases, it turns out, display each event 3 times.):

SELECT n.nid, n.title, n.status, n.moderate, e.* FROM node n 
INNER JOIN node_access na ON (na.nid = 0 OR na.nid = n.nid) 
INNER JOIN event e ON n.nid = e.nid 
WHERE n.type='event' AND na.grant_view = 1 AND 
     CONCAT(na.realm, na.gid) IN   
         ('all0','node_privacy_byrole_role1','node_privacy_byrole_user0','og_uid0',   
          'og_group0','term_access1') 
AND n.status = 1 
AND e.start >= 1111361177 
ORDER BY e.start LIMIT 0, 6

Does anyone reading this understand what the nodeperm_user module is trying to do here? Inner Join is a little new to me, so it isn't clear (1) what the SQL does, and (2) what the SQL ought to be doing.

Thanks,
Rob

Rob Thorne
Torenware Networks

ankur’s picture

The queries above should have a SELECT DISTICT(n.nid) in the beginning since it is possible for an nid in this query to show up more than once.

Also, it seems you are using organic groups (og_group0, ogroup1 ?) and that module also seems to be doing something to the permissions scheme.

Ankur Rishi
(CivicSpace)

Torenware’s picture

I've seen a report of a problem that looks comparable:
Module does not work correctly - all node types
I'm linking that issue to this post, and this links it back.

Thanks,
Rob

Rob Thorne
Torenware Networks