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
Comment | File | Size | Author |
---|---|---|---|
#29 | privatemsg_fieldable8.patch | 46.24 KB | Berdir |
#26 | privatemsg_fieldable7.patch | 46.03 KB | Berdir |
#22 | privatemsg_fieldable6.patch | 45.98 KB | Berdir |
#21 | privatemsg_fieldable5.patch | 46.18 KB | Berdir |
#19 | privatemsg_fieldable4.patch | 43.63 KB | Berdir |
Comments
Comment #1
BerdirIt 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.
Comment #2
bentonboomslang CreditAttribution: bentonboomslang commentedMany thanks for your swift reply.
I'll check there.
B
Comment #3
BerdirSetting this to postponed, we will think about this again with Drupal 7 where it should be easy.
Comment #4
BerdirComment #5
ari-meetai CreditAttribution: ari-meetai commentedDon'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...
Comment #6
litwol CreditAttribution: litwol commentedBig 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.
Comment #7
BerdirThis 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.
Comment #8
rburgundy CreditAttribution: rburgundy commentedsubscribing
Comment #9
BerdirTriggering a test of the patch, it will most certainly not apply...
Comment #11
BerdirRe-roll of the patch, fixed the tests...
Comment #12
BenK CreditAttribution: BenK commentedVery cool... subscribing.
Comment #13
NaheemSays CreditAttribution: NaheemSays commented#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.
Comment #14
BerdirYeah, 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.
Comment #15
NaheemSays CreditAttribution: NaheemSays commentedThat 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.
Comment #17
BerdirSimple 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.
Comment #19
BerdirFixed the failing tests...
Comment #21
BerdirFixed the last fail and also added a very basic test case for fields (and have found a bug while doing so).
Comment #22
BerdirFinal re-roll due to a conflict. Will probably commit this if it still passes the tests.
Comment #24
BenK CreditAttribution: BenK commentedBerdir,
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
Comment #25
BerdirI 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.
Comment #26
BerdirOk, this should now pass.
Comment #27
BenK CreditAttribution: BenK commentedOkay, 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
Comment #28
BenK CreditAttribution: BenK commentedComment #29
BerdirUhm, 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.
Comment #30
BerdirCommited 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.
Comment #31
andypostSuppose entity_uri was lost in this patch
Comment #32
BerdirYeah, must there be one?
The thing is, a single message does not have a entity_url, only threads do.
Comment #33
andypostSorry, my mistake.