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
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | fix_form.patch | 1.23 KB | berdir |
| sent message don't work.GIF | 24.92 KB | zhongguo999999 |
Comments
Comment #1
berdirI 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.
Comment #2
zhongguo999999 commentedIt's OK. Thanks a lot.
Comment #3
berdirThanks for reporting back, commited to 6.x-2.x and 7.x-1.x.