By Antikx on
I've upgraded to the latest 4.7 release of the privatemsg module, then I tried backporting the "preview" feature of the 5.x release to mt 4.7.x install
I tried modifying the privatemsg.module as per: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/privatemsg/...
Here is the code I put in, in case someone can spot something obvious problems with it on a 4.7 installation:
$form = array('preview' => array());
[move forward some lines...]
$form[] = array(
'#type' => 'submit',
'#value' => t('Preview')
);
$form[] = array(
[move forward some lines...]
$form['#after_build'] = array('_privatemsg_new_preview');
return $form;
}
[move forward some lines...]
function _privatemsg_new_preview($form, $form_values) {
if ($form_values['op'] == t('Preview')) {
$recipient = user_load(array('name' => $form_values['recipient']));
if ($recipient->uid) {
global $user;
$message->subject = $form_values['subject'];
$message->message = $form_values['privatemsgbody'];
$message->format = $form_values['format'];
message->timestamp = time();
$message->newmsg = TRUE;
$message->folder = 1;
$message->uid = $message->author = $user->uid;
$message->name = $user->name;
$message->recipient = $recipient->uid;
$form['preview'] = array(
'#prefix' => '<div class="preview">',
'#value' => theme('privatemsg_view', $message),
'#suffix' => '</div>');
drupal_set_title(t('Preview message'));
}
}
[move forward some lines...]
if ($form_values['op'] != t('Send private message')) {
return false;
}
After adding the code, now when I click on the "Write a new message" or when I reply to a message I get a blank page that says the single word: Array
Any suggestions, please?
Comments
bump
I hate to bump posts, but I'm really banging my head against the wall.
Any suggestions of a path I should consider taking?