Hi,

I'm total noob to Drupal, so I'm hoping that someone can help me out with this. I've searched the forums but I can't find an answer.

We are going to be building a community site using Drupal 6 and I've been tinkering with it on my own space. Part of the requirement of this site is that we can understand which users are posting to the forums, which are commenting on stories etc.

I'd hoped to be able to see this activity in the database, specifically I guess the `users' table and `forum' table, but it doesn't seem that they are tied together i.e. the forum table doesn't include uid from the users table.

Ideally i'd like to be able to run a report for certain user ids which pulls back the number of forum posts and number of comments for each of the users listed. Does anyone know how I can do this?

Comments

fabsor’s picture

I do not know if this satisfies all your needs, but you can start with enabling the tracker module. It keeps track of what users do and where they post/update. Tracker is part of core, so just go to site building -> modules and enable it. After you enabled it a new tab is available on all user profiles named "track". The actions of that users is available under this tab.

Drupals forum's are a little different from an ordinary forum since it is built with nodes. If you want to see the uid in the db, check the nodes table. There you have a uid collumn. If you for instance want to get all forum posts from the database you can use a query similar to this one:

SELECT user.uid, user.name FROM users INNER JOIN node ON user.uid = node.uid WHERE type = 'forum'

But this is rarely necessary since the tracker module can do it for you.

jinky32’s picture

thanks a lot fabian_sorqvist. Tracker is a great place to start and the nodes table ties together a lot of the info i'm looking for.

is there documentation anywhere of the contents of each table? it would make working out the right queries a lot easier!

fabsor’s picture

good question. There is to my knowledge no good overview of the drupal tables. I might write one myself when I have the time.