Php block messing with the page tittle I've added the privatemsg module send message form in a php block, it's working fine but the page tittle and the metatag tittle now shows "write a new message to(user uid)" instead of the node tittle.

this is the code in the php block:

`&lt;?php
 module_load_include('pages.inc','privatemsg');
 $node = node_load(arg(1));
 $recipients = strip_tags($node-&gt;uid);
 $subject = 'custom subject';
 print '&lt;div class="custom-msg"&gt;';
 print drupal_render(drupal_get_form('privatemsg_new', recipients,         
 $subject));
 print "&lt;/div&gt;";`


I can't figure out why this could be happening, i'm new to Drupal.

Thank you.

UPDATE

I've created a custom module as @burnsjeremy suggested, it works but the same error is happening.
Check the comment line in the code.

&lt;?php
module_load_include('pages.inc','privatemsg');
function seb_privatemsg_block_info(){
    $block['seb_msg'] = array(
       'info' =&gt; t('Seb Private Msg'),
       'cache' =&gt; DRUPAL_NO_CACHE
    );
    return $block;
}
/**
* Implements hook_block_view().
*/
function seb_privatemsg_block_view($delta = '') {
    $block = array();
    $block['subject'] = '';
    $block['content'] = seb_privatemsg_content();
    return $block;
}
function seb_privatemsg_content() {  
    $node = node_load(arg(1));
    $recipient = strip_tags($node-&gt;uid);
    $subject = 'custom subject';
    $output = '';
    // if i comment the following line the title is correct
    $output .= drupal_render(drupal_get_form('privatemsg_new', $recipient, $subject));
    return $output;
}


Any help would be greatly appreciated.
So I found an issue about this in the privatemsg issue queue, basically they are overwriting the page title when the form is embedded like this. So you need to use the code below to save the title before the form call and then set the title back to the saved one afterwards.

// Save the title.
$stored_title = drupal_set_title();
// Call the form.
print drupal_render(drupal_get_form('privatemsg_new', $recipients, $subject));
// Set title back to the saved version.
drupal_set_title($stored_title);


Here is the link to the issue if you want to do more research: https://www.drupal.org/node/1621198