I've managed to embed all the other pages within Panels as per the D7 Panels/Privatemsg patch, and the only remaining page is the /messages/view/%thread pages. After scouring the Privatemsg API documentation and the internet, I still cannot figure out how to manually present this view or how to embed it in another location either with the API or with regular Drupal theme .tpl.php overrides.

I need to get a sidebar on the /messages/view/* pages, preferably using panels.

  1. Is there a function call to produce or print the entire thread list/reply form?
  2. Do I have to break the reply form apart from the thread list?
  3. After obtaining the thread list using `privatemsg_thread_load()`, is it possible to pass the data back into the overridden privatemsg-view.tpl.php file?

Any and all thoughts or hints are welcome... thanks guys.


Take a look at privatemsg-view.tpl.php.

There is a preprocess hook where you may add theming variables to the privatemsg-view.tpl.php and execute any PHP code there. In my case it was:

function MYTHEME_preprocess_privatemsg_view(&$vars) {
  $vars['author_uid'] = $vars['message']->author->uid;
  $vars['realname']= MYMODULE_get_realname($vars['message']->author);

So here are some alternatives to populate the sidebar:

  • Use this PHP code to trigger a drupal context which will show a block on the sidebar
  • Programtically create other vars like the ones above. Those vars may contain sidebar data you can use when theming the TPL file which contains the sidebar.

Also, here is a full privatemsg theming guide.

  • I find it somewhat entertaining that you link to a question in which I have provided the answer :). I was hoping to get the sidebar outside of the privatemsg-view.tpl.php template.
    – emc
    Nov 12 '13 at 17:10
  • It's possible to print the message list as a PHP block and then drag it to a panel or otherwise put it on the sidebar. See the code in my question here: drupal.stackexchange.com/questions/91509/…. Hope this helps.
    – Druvision
    Nov 12 '13 at 21:55
  • @npc, I've edited my answer to include ideas on how to populate the sidebar.
    – Druvision
    Nov 13 '13 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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