[drupal-support] Small OG hack

Bill Fitzgerald bill at funnymonkeydata.com
Sun Aug 14 20:02:01 UTC 2005


Hello,

Working with Organic Groups for a web site for a local youth agency.

On the site, users can post into a few different forums -- each forum is 
defined as a term under the vocabulary of "Forums".  Users can also see 
blog posts, and blog posts can be in one of three different terms.

Currently in OG, when a user views the home page of their group, the 
columns that are shown are: Title, Author, Replies, Last reply.

I would like to show: Title, Author, Term, Replies, Last Reply.

I am not a programmer, but I have checked out the code of the OG module, 
and I have figured out the lines of code that need to be changed to add 
this feature.

The lines that output the group home page are (I think) 1630-1645; the 
two lines that would require any change are 1633 and 1639. Line 1633 
determines the top row of the table, and line 1639 prints out the posts 
specific to each group.

If (and this is a big if) I have read things correctly, the info printed 
in line 1639 is supplied by the function |og_get_home_nodes_sql|, which 
is on lines 619-629. The key part of this function is the query on line 628:

|return "SELECT DISTINCT(n.nid), n.title, n.uid, u.name, n.created, 
l.comment_count, l.last_comment_timestamp FROM {node} n INNER JOIN 
{node_access} og_na ON n.nid = og_na.nid INNER JOIN 
{node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON 
n.uid = u.uid WHERE og_na.gid = %d AND og_na.realm = 'og_group' AND 
n.status=1 AND $where ORDER BY n.sticky DESC, l.last_comment_timestamp 
DESC";|

Using the nid at the beginning of the query, I would like to query the 
term_node table to get any applicable terms for the node, and then query 
the term_data table to get the name of the term.

In short, I have a pretty good idea of the mechanics of how to get this 
done, but I don't know *how* to do it.

If I am way off base here, please tell me and I'll leave off.

If this is in the ballpark, any help would be appreciated.

Thanks,

Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://drupal3.drupal.org/pipermail/support/attachments/20050814/71214e3e/attachment.htm


More information about the drupal-support mailing list