Closed (fixed)
Project:
Activity
Version:
6.x-2.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
21 Jun 2009 at 05:48 UTC
Updated:
3 Oct 2009 at 09:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
Scott Reynolds commentedYa spotted this. It is because we don't join the node_revisions table. Really straight forward if you want to paste this into activity.views.inc function activity_views_data_alter
Comment #2
pribeh commentedWorks perfectly! Thanks.
Comment #3
Scott Reynolds commentedDo be careful with this change as it can produce duplicates if you have revisions turned on. A better join is needed, it needs to go through node and vid where n.nid = nr.nid AND n.vid = nr.vid.
Supporting multiple revisions will probably not be supported
Comment #4
sirkitree commentedComment #5
benroot commentedThis patch adds a relationship to the node table. Since node revisions are not involved there is no problem with duplicates. This patch was tested locally and provides access to the node fields and filters when the relationship is utilized in views.
Comment #6
Scott Reynolds commentedya but just looking at it tells me that hte node body isn't provided. (note the node body changed from table 'node' to table 'node_revisions' in Views 2.6 and onward)
Comment #7
benroot commentedThe node body is available to Activity views using Views 2.6 and the patch in #5. Here is a screenshot of the node body field added to an activity view: http://img.skitch.com/20090715-pdiump84iqgjetaby3g74n85d3.png. The rendered view also displays the node body correctly in my local tests. The ability to utilize the node body as a field is preserved despite the views 2.6 change mentioned in #6.
Comment #8
drewish commentedre #6, i haven't tested benroot's patch but i'm thinking that views would be smart enough to build a join path to revisions once it gets to node.
Comment #9
Scott Reynolds commentedI concur, having this is the right way, as opposed to what we have been doing. This should go in.
Comment #10
drewish commentedTested that the node body can be joined correctly.
This goes one step further and adds in a User relation—though currently the user is always the node author but I'll address that in the correct issue.
Comment #11
Scott Reynolds commentedThis needs to get rid of the activity_views_data_alter() $data['node']['join'] stuff as well.
This relationship will replace this.
And as a bonus, it can also get rid of the ugly activity_db_rewrite_sql() because I believe the node_access filter will be exposed as well.
Note: just read the patch didn't apply it to my working copy.
Comment #12
drewish commentedScott Reynolds, the relationships and joins aren't bidirectional so you'll still need the hook_views_data_alter() to get them in there when node is the base table but your comment made me wonder why use a relationship? We might as well just specify it as a join so that you see User and Node without having to jump through another hoop. If you want the node's user then add a relationship.
I'm not sure how activity_db_rewrite_sql() comes into play. I'll have to give that a look.
Comment #13
pribeh commentedTested the 497666.patch with the Jul-16 dev version and no luck with getting the node -> body to show up under views.
Comment #14
drewish commentedpribeh, did you clear the views cache before testing it? there's a button to do so under view's tools tab.
Comment #15
drewish commentedpribeh, actually which patch did you try? the one from #12?
Comment #16
pribeh commentedTested with the patch in #12 and caches have been reset. The patch Scott Reynolds put forth in number #1 works fine though. Sorry, wish I had more info. The patching process works successfully but just no node->body visible in views.
Comment #17
pribeh commentedTested patch with latest Activity dev and still no luck.
Comment #18
Scott Reynolds commentedhttp://drupal.org/cvs?commit=264252
Uses relationships so that we can set the proper base table and such. Brings in all the CCK stuff (got rid of that mess) and allows us to remove hook_db_rewrite_sql().
I didn't actually see this at all. It was the proper one.
edit make sure you clear your Views cache
Comment #19
pribeh commentedWorks so well!