The Private Message module displays conversations between users as "threads" that resemble e-mail or forum friends. I am attempting to customize the default display by printing a view that shows the recipient/sender profile information.

Through trial and error I arrived at the following code, which prints out the view content pane that I want.

  foreach($thread['participants'] as $participants => $participant ) {
    global $user;
    if ($user->uid !== $participant->uid) {
      print views_embed_view('profile_show_user_interests','show_interests_own', $participant->uid);

This code resides in privatemsg.pages.inc in function privatemsg_view($thread), which returns the content of the page for rendering.

The problem with this is that print views_embed_view() prints the content pane out at the top of the page, above the header, with no extra markup. How can I print the content pane in the content region of the page?

1 Answer 1


As a starting point I would have the function return the view rather than attempting to print it. Try:

 $content['view'][] = views_embed_view('profile_show_user_interests','show_interests_own', $participant->uid);

and then render it in the page at the proper place. (views_get_view might be better in this context.)

  • Thanks! The actual code I used to get it working, based on your hint, was this: $content['view'][]['#markup'] = views_embed_view('profile_show_user_interests','show_interests_own', $participant->uid); Commented Apr 13, 2013 at 0:13

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.