admin_menu has a link to admin/reports/status/run-cron . This can be clicked any where on the site.

Current behaviour: after cron has run, browser is redirected to admin/reports/status - irritating

Expected behaviour: after cron has run, browser is redirected to the page the link was clicked on, i.e. the referer

Comments

mr.baileys’s picture

Status: Needs review » Needs work
  1. Core normally uses a combination of drupal_get_destination and drupal_goto() to redirect back to the original page/form. To be consistent with the rest of core, it should probably be prefered over the REFERER if possible
  2. There might be some edge cases where the REFERER is not set (pasted link, link from email, ...). Should the current destination (admin/reports/status) be kept in this situation?
jbrown’s picture

Status: Needs work » Needs review

I think there are many menu items where it doesn't make sense to have a default destination - they have no 'home' page.

run cron, flushing caches, disable developer modules and switch user all fit into this category.

For these sorts paths I think it is better just to call drupal_goto($_SERVER['HTTP_REFERER']). They can just call drupal_set_message() to output a response.

The 'destination' query parameter can be used to set the destination page explicitly if required.

If the menu item is fired with no referer, then Drupal sets $_SERVER['HTTP_REFERER'] to '' and drupal_goto will redirect to the front page. This makes sense for this sort of menu item.

For Drupal 8 I want to add a new menu type constant that calls drupal_goto($_SERVER['HTTP_REFERER']) when the page callback returns, so this sort of menu item is even simpler.

Status: Needs review » Needs work

The last submitted patch failed testing.

Status: Needs work » Needs review

Re-test of cron_referer.patch from comment @comment was requested by ChrisKennedy.

MichaelCole’s picture

cron_referer.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, cron_referer.patch, failed testing.

digitalpiku’s picture

Assigned: jbrown » digitalpiku
Status: Needs work » Needs review
StatusFileSize
new407 bytes

Fixed this issue , review needed.

Status: Needs review » Needs work

The last submitted patch, cron_referer.patch, failed testing.

digitalpiku’s picture

Status: Needs work » Needs review
StatusFileSize
new1 KB

Please re-test

digitalpiku’s picture

StatusFileSize
new617 bytes

Status: Needs review » Needs work

The last submitted patch, cron_referer.patch, failed testing.

digitalpiku’s picture

Status: Needs work » Needs review
StatusFileSize
new435 bytes

Please review

digitalpiku’s picture

Status: Needs review » Fixed

Yipee, Finally It has been fixed!!

digitalpiku’s picture

Status: Fixed » Needs review

Please review

damien tournoud’s picture

Status: Needs review » Closed (works as designed)

This works as designed. We don't send the user back to the referring page. If you want the user to be redirected somewhere else, use the destination parameter.