Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I've got a question on the overall architecture. Why aren't threads (not messages) declared with hook_entity_info? Wouldn't it make maintaining the pm_filter module, as you could use real fields?
I would like to add fields to privatemsg threads, which is why I'm asking.
Thanks!
Comments
Comment #1
nagiek CreditAttribution: nagiek commentedIt's also necessary for views integration. A base table for pm_thread would also be desirable, even if all it keeps is an index.
Comment #2
BerdirAs you've figured out, threads are currently more or less a "virtual" thing, they don't have a base table, messages just happen to be in the same thread if they have the same thread_id.
I've been working on this for quite some time, have a look at #744374: Introduce a pm_thread table. The patch there adds two new tables, one for the thread and one for basically a "thread summary" for each recipient. The patch is currently only available for 6.x-2.x. So, what's necessary is:
- Get the patch there commited, requires testing (especially the upgrade path for big data sets), I'd also love an actual review.
- Port the patch to 7.x-2.x (7.x-1.x is out of the question, as that is stable).
- Then make threads an entity (not fieldable just at that point)
- Then think about how to make it fieldable (for example, the new message form would be some kind of double-entity, as it will become both a message and a thread and would need both fields, something that probably hasn't been done yet).
- At that point, it should also become possible to add proper views integration and declare the privatemsg_views project for deprecated. But before that can happen, there's a lot of work to do.
Any help is welcome...
Comment #3
nagiek CreditAttribution: nagiek commentedCan't disagree with you on the work... definitely a lot to do.
I took a brief glance at the pm_thread patch, looks like it's been sitting there for a while... I'll place my comments in that issue.
In terms of the final form, Private Threads and Messages are pretty analogous to Nodes and Comments. And as for a template, the Drupal project comment form seems to work. (the answer is staring us in the face!)
Either way, I'm glad you're motivated to work on this!
Comment #4
BerdirNo, node/comment is not the same thing.
There, you first create a node, and then you create comments later on.
With private messages, when you send a new message to someone, you create a thread *and* a message at the same time.
So both fields of the thread and fields of the message would be visible. And you'd need to make sure that they don't override each other...
Comment #5
nagiek CreditAttribution: nagiek commentedAgreed, I meant node/comment for the admin section, not the form. I would imagine the form as two objects with two calls to field_attach_form. Definitely simultaneous.
Comment #6
ivnish CreditAttribution: ivnish commented