I need to redirect the user to a destination and show a confirmation/error message. How can I do that? This is my code:
watchdog('webform', 'The user @user has been successfully created', array('@user'=> $mail));
drupal_set_message(t('Settings saved.', array()));
drupal_goto(drupal_get_destination());
This code redirects, but the message is not shown. Do i need some special action in the destination page?
EDIT - the problem is that i'm redirecting to an administrative page and the message is showing in the main theme, i want it to display on the overlay theme. I'll explain a little bit more in depth what i'm doing (this could be totally wrong).
I added a link that the user can click when he is viewing a submission entered through a webform (webform module). i defined a menu voice for that link in this way (i'ts only a callback, no page is shown):
$items ['createuser/%'] = array (
'title' => 'Create users',
'access callback' => TRUE,
'page callback' => 'provintegra_createuser',
'page arguments' => array (
1 ),
'type' => MENU_CALLBACK );
Then i defined provintegra_createuser
function provintegra_createuser($sid) {
//save user
watchdog ( 'webform', 'L\'utente @utente è stato creato cons successo', array (
'@utente' => $mail ) );
drupal_set_message(t('Settings saved.', array()));
drupal_goto(drupal_get_destination());//This redirects you to the page of the webform submission in the overlay
}
I se the message "Setting saved" but it's in the main theme, not in the theme (seven) i'm using for the administrative overlay. Do i need to set some special parameter so that the message is shown in the overlay?
$messages
variable is showing up on the destination page?