Closed (fixed)
Project:
Privatemsg
Version:
7.x-1.2
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
9 Feb 2012 at 15:43 UTC
Updated:
28 Feb 2012 at 08:50 UTC
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
Comment #1
berdirdrupal_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)
Comment #2
ykyuen commentedit works and i have updated the documentation. thanks.