In Drupal 7, on a custom user profile page (using user-profile.tpl.php) I would like to place a view that references all nodes of a specific content type that has that user as a reference. (The user may, or may not be an author of the node.)
1 Answer
use views_embed_view to embed a view:
$views = views_embed_view('VIEW_NAME', 'DISPLAY_ID');
print render($views);
The DISPLAY_ID is typically 'page' or 'block' depending on the displays you have setup in views.
You can build the view with a contextual filter to get all nodes with a user reference.
If you don't need to embed the view in the middle of your user profile you can just use a block output and show that block before or after your user profile.
-
Thanks! For those looking for more info, I found it here this morning: drupalcontrib.org/api/drupal/contributions--views--views.module/…– BaumerCommented Nov 3, 2011 at 17:49