Hi guys, I have embeded a privatemsg box as a block for a node, but I have just one problem, The title of the page should be the nodes title and not "Write new message to ..." How can I change this?

CommentFileSizeAuthor
#7 page-title-705804-7.patch1.11 KBaramboyajyan
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir’s picture

Component: User interface » Code
Category: support » bug
Priority: Critical » Normal

Hm. I suppose moving the drupal_set_title() out of the form and instead add a helper function that is called as the page callback that only sets the title would be the correct fix.

I assume you call the form from your node template?

There are two workarounds I can think of...
1. Call drupal_get_form() in a module in hook_nodeapi(), $op = 'view', something like:

$node->privatemsg = drupal_get_form('privatemsg_new', ...);

2. Re-set the title after you call drupal_get_form():

echo drupal_get_form('privatemsg_new', ...);
drupal_set_title(check_plain($node->title));

Re-classifing the issue, will create a proper fix later.

WaQuEe’s picture

Status: Active » Closed (fixed)

Thanks, it worked perfectly!!! Well I loaded the form in a block, all I did was set the title as you said:


$node=node_load(arg(1));
$newuser = array(user_load($node->uid));
$recipients = array(user_load($node->uid));
$subject =  $node->title;
echo drupal_get_form('privatemsg_new', $recipients, $subject);
drupal_set_title(check_plain($node->title));

Berdir’s picture

Status: Closed (fixed) » Active

Don't set issues to closed, but fixed instead. (fixed issues are automatically marked as closed after 2 weeks of inactivity but still displayed to see for others). And in this special case, let's keep this open to work on a proper fix without the need for an workaround.

jonhy81’s picture

+1. Thanks.

KiLLAH89’s picture

Issue summary: View changes

And how can i get the title of a user panel page with D7?

Thanks

aramboyajyan’s picture

Assigned: Unassigned » aramboyajyan

I am having the same issues; will prepare the patch for all active branches and post it here shortly.

aramboyajyan’s picture

Status: Active » Needs review
FileSize
1.11 KB

Status: Needs review » Needs work

The last submitted patch, 7: page-title-705804-7.patch, failed testing.

oadaeh’s picture

Status: Needs work » Closed (won't fix)

This issue is being closed because it is against a branch for a version of Drupal that is no longer supported.
If you feel that this issue is still valid, feel free to re-open and update it (and any possible patch) to work with the 7.x-1.x branch (bug fixes only) or the 7.x-2.x branch.
Thank you.