Why use Views for private messages ?
To list private messages in blocks, for example. To create user dashboards. To output private message lists in different non-obvious places.
Views is not just a contrib module, it is a framework on top of Drupal, a whole ecosystem of modules. Views integration brings great features of the ecosystem to private messages:
- Additional fields printed together with messages
- Configurable displays
- Flexible paging, including AJAX support
- Third-party modules integration (e.g. Panels)
and many more..
There's also an additional argument that using Views could reduce amount of code in the Privatemsg module, if it was built on top of Views. However Privatemsg developers preferred to reinvent the wheel with own query builder and own theming layer.
Privatemsg Views module provides a base: exposes data to Views, and provides basic integration.
Privatemsg Views UI module provides Views based UI. At the moment it implements "Mailbox" view and "Thread" view.
Privatemsg sub-modules currently supported:
- Block user messages
Note that features of sub-modules are not included in default views provided with the module. You need to manually add them. E.g. you may want to add "Privatemsg Blocked: No" filter.
Installation and usage
- Install module and it's requirements as usual.
- Use "privatemsg_example" view as an example of "mailbox" view, or create more simple "message" view yourself. If additional message/thread listings is everything you need, you may stop here.
- Enable "Privatemsg Views UI" module if you want to build Views-based UI
- Tweak provided default views depending on your usecase, modules used etc.
You may both configure default views provided with the module (recommended) or clone them and work with cloned versions (not recommended for most users cause you will have to implement your own preprocess functions and templates).
Privatemsg Views UI module has it's settings page at "admin/settings/messages/privatemsg_views_ui" where you can switch views used for "Mailbox view" and "Thread view" pages.