Hello
This is a great module. I'd like to know if it is possible to parse arguments to private message. Maybe it's better to just explain the situation:
- I will include a link "contact author" on several diferent nodes.
- The idea would be to include the node where the person clicked to generate the page.
- In the message, for example the subject would be: [nid] subject here or something. Or even something in the message itself where I could identify the node.
thanks !
Leo
Comments
Comment #1
berdirI am not sure if I exactly understand what you mean.
There are several ways to act or hook in when a message is sent (hook_form_alter, our own hooks, see http://drupal.org/node/369399). If you know enough about PHP, this shouldn't be a real problem. You could either display default values with hook_form_alter or append/prepend/replace something directly in the message before it's getting saved. The only thing you need to figure out is how to get your data you want to insert.
What we could provide is a easy way to set the subject/body to default values based on GET Parameters.
Feel free to ask specific questions about the implementation if you have any.
Comment #2
mcfly-1 commentedThanks for your answer. Let me expand on my example.
Suppose my website has 100 books for sale. A customer might want to contact me regarding a specific book, so I might have a link "Contact store regarding this book". What happens frequently is that the user forgets to specify what he/she is referring to, or might be too general. Privatemessage would insert a subject or even a snippet in the message body indicating where that click originated "[book: Shakespeare] i have a question !"...
Does that make sense ?
thanks
Leo
Comment #3
berdirThe easiest way to do this is something like the following:
1. Add a link to privatemsg which somehow contains the nid you want to refer to. For example, you can set use messages/new/your_uid?destination=/node/123. If you do this, the user will also be redirected back to your node when the private message is sent.
2. Either create a new module mymodule or put the following code inside one of your own modules (rename mymodule to the name of your module)
The code is provided without warranty and is untested :)
We may include a easier way to set the subject in the future, but you still need to load the node so that you know the type and name.
I am changing the issue a bit to make it a feature request for adding a subject variable..
Comment #4
Kakulash commentedSo currently the only thing that can be passed in the URL is "destination"?
Tested the solution above and it broke the site :(
Will check if syntax and everything was correct...
Comment #5
nathaniel commentedThanks this can be very useful.
Comment #6
mcfly-1 commentedThank you so much. I will try this and see what happens !
best
Leo
Comment #7
mcfly-1 commentedSorry, this does not work for me. The redirection portion works, however I can't have the subject changed at all. Any ideas ?
thanks
Leo
Comment #8
nathaniel commentedWhat code are you using for the link?
It has to look something like this:
Comment #9
mcfly-1 commentedStill no luck. This is what I am using:
thanks !
Leo
Comment #10
berdir#398916: Remove hook_form_alter in favor of a more flexible privatemsg_new form will allow to set the subject with a GET argument, setting this to duplicate.