2

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 1

1

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.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.