This is the code I used on the node template and block, I just tried it both
module_load_include('pages.inc','privatemsg');
$recipients = array(user_load(arg(1)));
$subject = 'This is just a default that can be changed';
$body = 'Again, this is just a default that can be changed';
print drupal_render(drupal_get_form('privatemsg_new', $recipients, $subject, $body));
The Bold ones are the codes I added from the orginal code I got from here: https://www.drupal.org/node/624528
But I'm getting this message when I added the $body:
You can not reply to this conversation because all recipients are blocked.
I've looked into the parameter of privatemsg and it says that the $body is the body text of the new message.
I would like to put some default body message on the embedded privatemsg.
I tried to edit the body via custom module, still no luck for me. I'm not sure where I went wrong.. here's the code on the custom module
function sassy_hook_form_privatemsg_new_alter(&$form, &$form_state, $form_id) {
$form['privatemsg_new']['body'] = array(
'#type' => 'textarea',
'#title' => t('Message'),
'#rows' => 6,
'#weight' => 0,
'#default_value' => t('Message'),
'#resizable' => TRUE, );
}
I also tried $form_state['values']['body'] = 'Hello World';
Is there any way to do this?
What am I missing?