Maybe I missed a setting but I was trying to figure out how to make it so that when a person sends a message via PM in the forums, that they return to the location they were at. I couldnt find anything so I created a hook

function XXX_form_privatemsg_new_alter(&$form, &$form_state){

if(!empty($_SERVER['HTTP_REFERER'])){
$parts = parse_url($_SERVER['HTTP_REFERER']);
$form['destination'] = array(
'#type' => 'hidden',
'#value' => substr($parts['path'],1),
);
}
}

I dont know if this should be part of the core module or not, but I thought I would share in case anyone else ran into a need for this

Comments

berdir’s picture

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

I don't think that this should be added to privatemsg.module..

a) Using HTTP_REFERER is imho not a default drupal behavior.
b) Privatemsg 6.x-2.x does now support send privatemsg links on nodes and comments, these links are fully configurable and also include a destination to link the user back to the node where he was.