Has anyone developed an extension that allows the private message creation part in a block, so that it can be interested into a page template?

Comments

zeezack’s picture

Has anyone tried this
http://drupal.org/node/624528

How would someone submit the private message via ajax?

zeezack’s picture

Hello Oleg,
I am not sure on the extenstion part, but it is possible to embed the private message section into the template pages.

<?php
  module_load_include('pages.inc','privatemsg');
  $recipients = array(user_load(arg(1)));
  $subject = 'Again, this is just a default that can be changed';
  print drupal_render(drupal_get_form('privatemsg_new', $recipients, $subject));
?>

My issue is trying to hook the form to make it ajax based.

http://drupal.org/node/624528#comment-6039804

I tried to hook into the form to build it and adjust the submit button as ajax. Its just not working.

function new_note_form($form, &$form_state, $nodeid = NULL) {
          $form_state['build_info']['args'] = array('note');
          $form = drupal_build_form('privatemsg_new', $form_state);

          $form['submit'] = array(
            '#type' => 'button',
            '#value' => 'Submit',
            '#limit_validation_errors' => array(),
            '#ajax' => array(
                'callback' => 'advanced_form_callback',
                'wrapper' => 'status',
            ),
          );

          return $form;
        }
Berdir’s picture

Priority: Critical » Normal
ptmkenny’s picture

Category: feature » support
ckng’s picture

Issue summary: View changes

Just created a new module for my own use. Feel free to try it out.
https://www.drupal.org/project/privatemsg_block

ivnish’s picture

Status: Active » Closed (outdated)