Hello,

Suppose that I am in user.module and I have a user object or a uid corresponding to a particular user. How can I determine what node that user is currently viewing?

Justin

Comments

sami_k’s picture

Doesn't exist, but you could write something which would add to the statistics module, basically tracking a uid in relation to a node. As the node is visited, the code would make an entry in a table and expire the old entry.
--
Read the handbook, search the forums, then ask!
http://drupal.etopian.net (Consulting, Development, and Hosting)

Wired Starion’s picture

But let me ask you another (sort of related) question.

I have installed the Organic groups module, so when a user creates a node he has to select which groups it should be posted to. Those groups are collectively called its audience.

So then, if I have a node object (some posting like a story or a calendar event for example), how can I determine whether a particular group is in its audience?

The reason that I want to do this, is that I am trying to modify the event calendar block so that it only lists events which were posted to the group that the user is currently viewing, that is the group with nid=arg(1). So what I would like to do is check the audience of each event and only mark the calendar with that event if the current group is in its audience. The ultimate goal is to have a site where a given user in a particular group only see content that is relevant to that group. He should see a Who's online block, for example, that only lists those users which are online and in that group (which is why I wanted to know how to tell what node a user was currently viewing), and so on.

If you have any thoughts about this I would really appreciate hearing them. I am just learning PHP and SQL and am also relatively new to Drupal. Thanks,

Justin

sami_k’s picture

This question is best addressed to Moshe Weitzman as he deals with that module.

--
Read the handbook, search the forums, then ask!
http://drupal.etopian.net (Consulting, Development, and Hosting)