1

I would like to create a listing page of users of a particular role.

Inside this view, there should be another view which shows the related content for each user.

When I try to create a view the system gives me the option to use just fields, but I need to be created like a node so I can use a tpl.php file.

How can I get a tpl.php file for this?

If I create a view for the users and one with the contents(contextual filter uid), can I embed the second view inside the view-unformatted.tpl.php?

1 Answer 1

2

Here I create similar page with views: http://cgart.ir/en/members

as you can see there is a list of users and 5 last uploaded image. the page created with views and latest artworks is another views.

to do that:

  1. create first view for list users and in Format select Show:Rendered entity | Settings
  2. create second view and configure CONTEXTUAL FILTERS and add Content: Author uid

edit user-profile.tpl.php and render second view there:

$account = $variables['elements']['#account'];
<?php print views_embed_view('second_view', 'page_1', $account->uid); ?>
4
  • Hi Mohammad, thanks for you answer, it does almost what I want. If you cloud tell me just the last thing. If i want to not affect the profile page it-self, in temrs of views and style, should I manage it through css? For example a want a box to be shown on the listing page but not in the profile page. How can I do this? Commented Apr 23, 2012 at 9:25
  • you can add new view mode to profile via hook_entity_info_alter() and with $view_mode = $variables['elements']['#view_mode']; you can make difference in full and list mode of user profile... let me know if it's not enough... Commented Apr 23, 2012 at 10:59
  • $view_mode is like $page? It makes differences beetwen listing and node? Now I will do some research. If I need suggestions, I will write it here. Commented Apr 23, 2012 at 11:12
  • go to views setting and in Show:Rendered entity | Settings select another view mode for list Commented Apr 23, 2012 at 12:43

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.