Hi all,

i want to put the form of the user profile page. so i created a block with the following code

  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_get_form('privatemsg_new', $recipients, $subject);

But it only print "Array", i used print_r() to print return value of drupal_get_form and it does contains the form object. so how could i print the form correctly?

i read the post here but i really dun understand how it could be solved by using $vars['contact'].

i also read the post Embed Privatemsg pages but i still couldn't get it.

Thanks.

Kit

Comments

berdir’s picture

Status: Active » Fixed

drupal_get_form() returns a render array in Drupal 7, you need to use drupal_render() to convert it to a string that you can print.

Please add that to the documentation (don't replace the existing example but add a commented out version for Drupal 7 below, similar to how it is further down for 6.x-2.x things)

ykyuen’s picture

it works and i have updated the documentation. thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.