I am trying to create a form with a default recipient and a default subject using the code in a node(Php filter):

// The first argument can be a list of user objects the message should be sent to. These are just default values and it is possibe to change them as a user.
// Example: Send to the user with uid 1.
$recipients = array(user_load(1));
// The second argument sets the default subject.
$subject = 'Again, this is just a default that can be changed';
module_load_include('pages.inc','privatemsg');
echo drupal_get_form('privatemsg_new', $recipients, $subject);

However, it don't work in 6.x-2.x-dev(but it work in 6.x-1.x) and it result in white screen.

Where do I start to look into this problem?

my setup is the following(xampp):

- Drupal 6.19
- Apache/2.2.11
- PHP 5.2.9
- Mysql 5.0.51a
- Privatemsg 6.x-2.x

Comments

berdir’s picture

Status: Active » Needs review
StatusFileSize
new1.23 KB

I have no clue why this results in a white screen but the problem is because the form expects recipients objects, not simply user objects (they don't have the type/recipient property). The attached patch fixes compatibility with that.

You could also use privatemsg_user_load() instead of user_load(), that won't have this problem.

zhongguo999999’s picture

It's OK. Thanks a lot.

berdir’s picture

Status: Needs review » Fixed

Thanks for reporting back, commited to 6.x-2.x and 7.x-1.x.

Status: Fixed » Closed (fixed)

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