Download & Extend

Adding new fields to Private Messages

Project:Privatemsg
Version:7.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I'm sure I'm not the first to ask this but I can't find any other threads here that answer my question.

I wonder how easy it would be to add one or two extra fields to a Private Message (like you can with CCK).

I ask because on my site messages will be sent in reference to a particular piece of content (think of it as a "private comment" that comes to the content creator's inbox) therefore it would be vital to include in the message a field that contains the content referred to in the message.

Is this possible? If so could you give me a few pointers on how I could start to implement this (I'm fairly new to this wonderful world!)

Many thanks,

B

Comments

#1

It is possible, see #342733: Create upgrade path from privatemsg_attachments to filefield. In that issue is a sub module that does exactly the same as the Upload module for Nodes.. it adds a file field to messages.

We will maybe add Fields support for D7 that might make this easier.

#2

Many thanks for your swift reply.

I'll check there.

B

#3

Setting this to postponed, we will think about this again with Drupal 7 where it should be easy.

#4

Status:active» postponed

#5

Don't think it would be a huge problem to add a couple more of fields to messages using the privatemsg module and custom coding. What could be nice is an admin screen for all that...

#6

Version:6.x-1.x-dev» 7.x-1.x-dev

Big no until drupal 7. Unless of course some one wants to sponsor specific fields development. But i think it will be waste of time and effort until we build it for d7 because fields are in core already in d7.

#7

Category:support request» feature request
Status:postponed» needs review

This is a first, not very well tested patch.

To be fieldable, $message needs to be an object instead of an array. That's why the patch is so huge. Additionally, the patch implements the necessary hooks and makes the required field_attach_* calls. The that some parts are far from being perfect, for example is the content of the fields simply appended to the existing message body.

There are also a few other changes and bugfixes which I might also split up into other patches. One of them is that I removed the privatemsg fieldset in the privatemsg_new form. Not sure about that yet, but with it, there are issues with the weight of the added fields.

There is also a pager bug, which is fixed by the patch. I will most certainly split that into another patch.

AttachmentSizeStatusTest resultOperations
privatemsg_fieldable.patch36.43 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch privatemsg_fieldable.patch.View details

#8

subscribing

#9

Triggering a test of the patch, it will most certainly not apply...

#10

Status:needs review» needs work

The last submitted patch, privatemsg_fieldable.patch, failed testing.

#11

Status:needs work» needs review

Re-roll of the patch, fixed the tests...

AttachmentSizeStatusTest resultOperations
privatemsg_fieldable2.patch41.99 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch privatemsg_fieldable2.patch.View details

#12

Very cool... subscribing.

#13

#11: privatemsg_fieldable2.patch queued for re-testing.

If this passes, probably best to commit without waiting.

Otherwise, two patches would be more easily grockable - the background cleanup to use objects everywhere and then a smaller one just focussing on the fields. but this would only work well if someone had more time to take part in reviewing currently. I would just commit.

#14

Yeah, probably.

I'm not sure about the message body part, that is currently quite a hack. Aka, the fields are simply appended to the message body instead of making the whole thing into a renderable array.

#15

That can be fixed through iterating over what you have written in later commits - as long as there are big fat warnings that the current release is dev only and not 100% supported, I see no problem with that.

#16

Status:needs review» needs work

The last submitted patch, privatemsg_fieldable2.patch, failed testing.

#17

Status:needs work» needs review

Simple re-roll of the patch.

Still not sure about commiting, I'd like to see a some testing before doing so but that might be hard to get so I will probably simply commit it.

AttachmentSizeStatusTest resultOperations
privatemsg_fieldable3.patch41.62 KBIdleFAILED: [[SimpleTest]]: [MySQL] 948 pass(es), 4 fail(s), and 368 exception(es).View details

#18

Status:needs review» needs work

The last submitted patch, privatemsg_fieldable3.patch, failed testing.

#19

Status:needs work» needs review

Fixed the failing tests...

AttachmentSizeStatusTest resultOperations
privatemsg_fieldable4.patch43.63 KBIdleFAILED: [[SimpleTest]]: [MySQL] 1,035 pass(es), 1 fail(s), and 0 exception(es).View details

#20

Status:needs review» needs work

The last submitted patch, privatemsg_fieldable4.patch, failed testing.

#21

Status:needs work» needs review

Fixed the last fail and also added a very basic test case for fields (and have found a bug while doing so).

AttachmentSizeStatusTest resultOperations
privatemsg_fieldable5.patch46.18 KBIdlePASSED: [[SimpleTest]]: [MySQL] 1,093 pass(es).View details

#22

Final re-roll due to a conflict. Will probably commit this if it still passes the tests.

AttachmentSizeStatusTest resultOperations
privatemsg_fieldable6.patch45.98 KBIdleFAILED: [[SimpleTest]]: [MySQL] 156 pass(es), 43 fail(s), and 4 exception(es).View details

#23

Status:needs review» needs work

The last submitted patch, privatemsg_fieldable6.patch, failed testing.

#24

Berdir,

Just saw that you posted a new patch... was going to test this over the weekend. Would you rather commit and then have me test the entire 7.x-1.x-dev branch? Or are you planning to post another patch that passes the tests?

Let me know how I can be most helpful...

--Ben

#25

I will commit it once it passes the tests again.

Since nobody is (hopefully ;)) using 7.x-1.x-dev in production, it shouldn't be a big problem if there are a few bugs in the -dev release for a while.

#26

Status:needs work» needs review

Ok, this should now pass.

AttachmentSizeStatusTest resultOperations
privatemsg_fieldable7.patch46.03 KBIdleFAILED: [[SimpleTest]]: [MySQL] 1,091 pass(es), 2 fail(s), and 0 exception(es).View details

#27

Status:needs review» needs work

Okay, sounds good. I'll wait until you commit this to the -dev branch and then start a thorough testing of all features.

By the way, I also was planning to test your recent token patch (http://drupal.org/node/511796) over the weekend. Will that still apply cleanly to the 7.x -dev branch after this commit? I'm assuming there's not any overlap...

Thanks,
Ben

#28

Status:needs work» needs review

#29

Uhm, good that I wrote a small tests, I forgot an important field function when re-rolling.

@BenK: the token patch will most probably not apply anymore but that's easy to re-roll.

AttachmentSizeStatusTest resultOperations
privatemsg_fieldable8.patch46.24 KBIdlePASSED: [[SimpleTest]]: [MySQL] 1,093 pass(es).View details

#30

Status:needs review» fixed

Commited to 7.x-1.x-dev!

@BenK

When testing, please open separate issues for different bugs unless they obviously belong together. That makes it easier to address them separatly with smaller patches.

#31

Suppose entity_uri was lost in this patch

#32

Yeah, must there be one?

The thing is, a single message does not have a entity_url, only threads do.

#33

Sorry, my mistake.

#34

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here