drupal_goto
- 5 – 6
drupal_goto($path = '', $query = NULL, $fragment = NULL, $http_response_code = 302)
- 7
drupal_goto($path = '', array $options = array(), $http_response_code = 302)
Send the user to a different Drupal page.
This issues an on-site HTTP redirect. The function makes sure the redirected
URL is formatted correctly.
Usually the redirected URL is constructed from this function's input
parameters. However you may override that behavior by setting a
destination in either the $_REQUEST-array (i.e. by using
the query string of an URI) or the $_REQUEST['edit']-array (i.e. by
using a hidden form field). This is used to direct the user back to
the proper page after completing a form. For example, after editing
a post on the 'admin/content/node'-page or after having logged on using the
'user login'-block in a sidebar. The function drupal_get_destination()
can be used to help set the destination URL.
Drupal will ensure that messages set by drupal_set_message() and other
session data are written to the database before the user is redirected.
This function ends the request; use it rather than a print theme('page')
statement in your menu callback.
See also
drupal_get_destination()
Parameters
$path
A Drupal path or a full URL.
$query
A query string component, if any.
$fragment
A destination fragment identifier (named anchor).
$http_response_code
Valid values for an actual "goto" as per RFC 2616 section 10.3 are:
- 301 Moved Permanently (the recommended value for most redirects)
- 302 Found (default in Drupal and PHP, sometimes used for spamming search
engines)
- 303 See Other
- 304 Not Modified
- 305 Use Proxy
- 307 Temporary Redirect (alternative to "503 Site Down for Maintenance")
Note: Other values are defined by RFC 2616, but are rarely used and poorly
supported.
- admin_menu_flush_cache in contrib/admin_menu/admin_menu.inc
- Flush all caches or a specific one.
- admin_menu_toggle_modules in contrib/admin_menu/admin_menu.inc
- Menu callback to enable/disable developer modules.
- aggregator_admin_refresh_feed in core/modules/aggregator/aggregator.admin.inc
- Menu callback; refreshes a feed, then redirects to the overview page.
- backup_migrate_shutdown in contrib/backup_migrate/backup_migrate.module
- Shutdown callback. Called when the script terminates even if the script timed out.
- backup_migrate_ui_destination_delete_file in contrib/backup_migrate/includes/destinations.inc
- Menu callback to delete a file from a destination.
- backup_migrate_ui_destination_display_files in contrib/backup_migrate/includes/destinations.inc
- List the backup files in the given destination.
- backup_migrate_ui_destination_download_file in contrib/backup_migrate/includes/destinations.inc
- Download a file to the browser.
- backup_migrate_ui_destination_restore_file in contrib/backup_migrate/includes/destinations.inc
- Restore a backup file from a destination.
- batch_process in core/includes/form.inc
- Processes the batch.
- calendar_views_query_alter in contrib/calendar/includes/calendar.views.inc
- Implementation of hook_views_query()
- captcha_validate in contrib/captcha/captcha.module
- CAPTCHA validation handler.
- ca_predicate_delete_form in contrib/ubercart/ca/ca.admin.inc
- Form to reset a modified module defined predicate to its original state.
- ca_predicate_meta_form in contrib/ubercart/ca/ca.admin.inc
- Form to allow the creation and editing of conditional action predicates.
- comment_multiple_delete_confirm in core/modules/comment/comment.admin.inc
- List the selected comments and verify that the admin really wants to delete
them.
- comment_reply in core/modules/comment/comment.pages.inc
- This function is responsible for generating a comment reply form.
There are several cases that have to be handled, including:
replies to comments
replies to nodes
attempts to reply to nodes that can no longer accept comments
respecting access...
- ctools_export_ui_edit_item_form_delete in contrib/ctools/plugins/export_ui/ctools_export_ui.class.php
- Submit handler to delete for ctools_export_ui_edit_item_form
- ctools_search_form_content_type_render in contrib/ctools/plugins/content_types/search/search_form.inc
- Render the custom content type.
- devel_cache_clear in contrib/devel/devel.module
- Menu callback; clears all caches, then redirects to the previous page.
- devel_menu_rebuild in contrib/devel/devel.module
- Menu callback; clear the database, resetting the menu to factory defaults.
- devel_queries_empty in contrib/devel/devel.module
- devel_rebuild_node_comment_statistics_page in contrib/devel/devel.module
- Menu callback. Rebuild node _comment_stats table.
- devel_switch_user in contrib/devel/devel.module
- Switch from original user to another user and back.
- drupal_redirect_form in core/includes/form.inc
- Redirect the user to a URL after a form has been processed.
- event_feed in contrib/event/event.module
- Url wrapper function for rss feeds
- event_ical in contrib/event/event.module
- Url wrapper function for ical feeds
- event_page in contrib/event/event.module
- Displays a page containing event information. The page layout defaults to a
graphical calendar.
- event_term in contrib/event/event.module
- Url wrapper function for static link to calendar by taxonomy terms.
- event_type in contrib/event/event.module
- Url wrapper function for static link to calendar by content type.
- features_cleanup_form in contrib/features/features.admin.inc
- Form for disabling orphaned dependencies.
- filter_admin_delete in core/modules/filter/filter.admin.inc
- Menu callback; confirm deletion of a format.
See alsofilter_admin_delete_submit()
- fivestar_form_submit in contrib/fivestar/fivestar.module
- Submit handler for the above form (non-javascript version).
- flag_delete_confirm in contrib/flag/includes/flag.admin.inc
- Delete flag page.
- flag_form in contrib/flag/includes/flag.admin.inc
- Add/Edit flag page.
- flag_page in contrib/flag/flag.module
- Menu callback for (un)flagging a node.
- front_page in contrib/front/front_page.module
- *********************************************
Function to handle the display of the front page.
- globalredirect_init in contrib/globalredirect/globalredirect.module
- Implementation of hook_init().
- imagecache_ui_action_add_page in contrib/imagecache/imagecache_ui.pages.inc
- Page with form for adding a new action to add to a preset.
- imagecache_ui_action_delete_form in contrib/imagecache/imagecache_ui.pages.inc
- imagecache_ui_action_form in contrib/imagecache/imagecache_ui.pages.inc
- imagecache_ui_preset_delete_form in contrib/imagecache/imagecache_ui.pages.inc
- image_view in contrib/image/image.module
- Implementation of hook_view
- imce_profile_delete_form in contrib/imce/inc/imce.admin.inc
- Profile delete form
- img_assist_cache_clear in contrib/img_assist/img_assist.module
- Menu callback; clears relevant caches, then redirects to the previous page.
See alsodevel_cache_clear()
- img_assist_properties_form_validate in contrib/img_assist/img_assist.module
- locale_languages_delete_form in core/includes/locale.inc
- User interface for the language deletion confirmation screen.
- locale_translate_edit_form in core/includes/locale.inc
- User interface for string editing.
- logintoboggan_resend_validation in contrib/logintoboggan/logintoboggan.module
- Re-sends validation e-mail to user specified by $uid.
- logintoboggan_validate_email in contrib/logintoboggan/logintoboggan.module
- Menu callback; process validate the e-mail address as a one time URL,
and redirects to the user page on success.
- mollom_admin_form_options in contrib/mollom/mollom.admin.inc
- Return registered forms as an array suitable for a 'checkboxes' form element #options property.
- nodequeue_admin_add_node in contrib/nodequeue/nodequeue.module
- Page callback to add a node to a queue.
- nodequeue_admin_remove in contrib/nodequeue/nodequeue.module
- Page callback to remove an item from a queue. This will be used only
if javascript is disabled in the client, and is a fallback technique.
This differs from nodequeue_admin_remove_node in that it removes a
specific position, which is necessary in case...
- nodequeue_admin_remove_node in contrib/nodequeue/nodequeue.module
- Page callback to remove a node from a queue.
- og_approve in contrib/og/og.module
- og_deny in contrib/og/og.module
- og_subscribe in contrib/og/og.pages.inc
- openid_authentication in core/modules/openid/openid.module
- Authenticate a user or attempt registration.
- openid_authentication_page in core/modules/openid/openid.pages.inc
- Menu callback; Process an OpenID authentication.
- page_manager_enable_page in contrib/ctools/page_manager/page_manager.admin.inc
- Menu callback to enable or disable a page
- page_manager_list_page in contrib/ctools/page_manager/page_manager.admin.inc
- Output a list of pages that are managed.
- page_manager_page_add_subtask in contrib/ctools/page_manager/plugins/tasks/page.admin.inc
- Page callback to add a subtask.
- panels_goto in contrib/panels/panels.module
- Perform a drupal_goto on a destination that may be an array like url().
- panels_node_form in contrib/panels/panels_node/panels_node.module
- Implementation of hook_form().
- path_redirect_goto in contrib/path_redirect/path_redirect.module
- performance_clear_apc_confirm_submit in contrib/devel/performance/performance.module
- performance_clear_memcache_confirm_submit in contrib/devel/performance/performance.module
- search_admin_settings_validate in core/modules/search/search.admin.inc
- Validate callback.
- search_view in core/modules/search/search.pages.inc
- Menu callback; presents the search form and/or search results.
- simplenews_admin_types_form in contrib/simplenews/simplenews.admin.inc
- Menu callback: newsletter admin form for newsletter add/edit.
See alsosimplenews_admin_types_form_validate()
- simplenews_admin_types_form_submit in contrib/simplenews/simplenews.admin.inc
- simplenews_subscription_admin in contrib/simplenews/simplenews.admin.inc
- Menu callback: subscription administration.
- system_actions_configure in core/modules/system/system.module
- Menu callback. Create the form for configuration of a single action.
- system_actions_remove_orphans in core/modules/system/system.module
- Remove actions that are in the database but not supported by any enabled module.
- system_admin_compact_page in core/modules/system/system.admin.inc
- Menu callback; Sets whether the admin menu is in compact mode or not.
- system_goto_action in core/modules/system/system.module
- system_modules_uninstall_validate in core/modules/system/system.admin.inc
- Validates the submitted uninstall form.
- system_run_cron in core/modules/system/system.admin.inc
- Menu callback: run cron manually.
- template_preprocess_views_ui_list_views in contrib/views/includes/admin.inc
- Preprocess the list views theme
- tinymce_admin in contrib/tinymce/tinymce.admin.inc
- Controller for tinymce administrative settings.
- token_actions_goto_action in contrib/token/token_actions.module
- trigger_assign in core/modules/trigger/trigger.admin.inc
- Build the form that allows users to assign actions to hooks.
- trigger_unassign in core/modules/trigger/trigger.admin.inc
- Confirm removal of an assigned action.
- trigger_unassign_submit in core/modules/trigger/trigger.admin.inc
- uc_2checkout_complete in contrib/ubercart/payment/uc_2checkout/uc_2checkout.pages.inc
- uc_attribute_delete_confirm in contrib/ubercart/uc_attribute/uc_attribute.admin.inc
- Confirm the deletion of the given attribute.
See alsouc_attribute_delete_confirm_submit()
- uc_attribute_option_delete_confirm in contrib/ubercart/uc_attribute/uc_attribute.admin.inc
- Confirm deletion of the given attribute option.
See alsouc_attribute_option_delete_confirm_submit()
- uc_attribute_option_form in contrib/ubercart/uc_attribute/uc_attribute.admin.inc
- Form builder for attribute options.
See alsouc_attribute_option_form_validate()
- uc_cart_add_item in contrib/ubercart/uc_cart/uc_cart.module
- Add an item to a user's cart.
- uc_cart_checkout in contrib/ubercart/uc_cart/uc_cart.pages.inc
- Display the cart checkout page built of checkout panes from enabled modules.
- uc_cart_checkout_complete in contrib/ubercart/uc_cart/uc_cart.pages.inc
- Completes the sale and finishes checkout.
- uc_cart_checkout_form in contrib/ubercart/uc_cart/uc_cart.pages.inc
- The checkout form built up from the enabled checkout panes.
- uc_cart_checkout_review in contrib/ubercart/uc_cart/uc_cart.pages.inc
- Allow a customer to review their order before finally submitting it.
See alsouc_cart_checkout_form()
- uc_cart_links_process in contrib/ubercart/uc_cart_links/uc_cart_links.pages.inc
- Process a cart link to fiddle with the cart and redirect the user.
- uc_catalog_buy_it_now_form_validate in contrib/ubercart/uc_product/uc_product.module
- Redirect to the product page if attributes need to be selected.
See alsouc_catalog_buy_it_now_form()
- uc_country_disable in contrib/ubercart/uc_store/uc_store.admin.inc
- Disable a country so it remains installed but is no longer selectable.
- uc_country_enable in contrib/ubercart/uc_store/uc_store.admin.inc
- Enable a disabled country.
- uc_country_remove_form_submit in contrib/ubercart/uc_store/uc_store.admin.inc
- @see uc_country_remove_form()
- uc_country_update in contrib/ubercart/uc_store/uc_store.admin.inc
- Update a country to its latest version.
- uc_credit_form_alter in contrib/ubercart/payment/uc_credit/uc_credit.module
- Implementation of hook_form_alter().
- uc_cybersource_receipt in contrib/ubercart/payment/uc_cybersource/uc_cybersource.module
- uc_file_admin_files_form_action_submit in contrib/ubercart/uc_file/uc_file.admin.inc
- @see uc_file_admin_files_action()
- uc_flatrate_admin_method_edit_form_delete in contrib/ubercart/shipping/uc_flatrate/uc_flatrate.admin.inc
- @see uc_flatrate_admin_method_edit_form()
- uc_google_checkout_cart_form_submit in contrib/ubercart/payment/uc_google_checkout/uc_google_checkout.module
- uc_google_checkout_terminal in contrib/ubercart/payment/uc_google_checkout/uc_google_checkout.admin.inc
- uc_object_attributes_form in contrib/ubercart/uc_attribute/uc_attribute.admin.inc
- Form to associate attributes with products or classes.
- uc_order_admin_sort_form_submit in contrib/ubercart/uc_order/uc_order.admin.inc
- @see uc_order_admin_sort_form()
- uc_order_delete_confirm_form in contrib/ubercart/uc_order/uc_order.admin.inc
- Confirmation form to delete an order.
See alsouc_order_delete_confirm_form_submit()
- uc_order_edit_form_submit in contrib/ubercart/uc_order/uc_order.admin.inc
- @see uc_order_edit_form()
- uc_order_mail_invoice_form_submit in contrib/ubercart/uc_order/uc_order.admin.inc
- @see uc_order_mail_invoice_form()
- uc_order_pane_line_items in contrib/ubercart/uc_order/uc_order.order_pane.inc
- Handle the "Line Items" order pane.
- uc_order_search_form_submit in contrib/ubercart/uc_order/uc_order.module
- @see uc_order_search_form()
- uc_order_select_form_submit in contrib/ubercart/uc_order/uc_order.admin.inc
- @see uc_order_select_form()
- uc_payment_delete_confirm_form in contrib/ubercart/payment/uc_payment/uc_payment.admin.inc
- uc_payment_process in contrib/ubercart/payment/uc_payment/uc_payment.module
- Process a payment through an enabled payment gateway.
- uc_paypal_cancel in contrib/ubercart/payment/uc_paypal/uc_paypal.pages.inc
- uc_paypal_complete in contrib/ubercart/payment/uc_paypal/uc_paypal.pages.inc
- uc_paypal_ec_checkout in contrib/ubercart/payment/uc_paypal/uc_paypal.module
- uc_paypal_ec_review in contrib/ubercart/payment/uc_paypal/uc_paypal.pages.inc
- uc_paypal_ec_review_form in contrib/ubercart/payment/uc_paypal/uc_paypal.pages.inc
- uc_paypal_ec_review_redirect in contrib/ubercart/payment/uc_paypal/uc_paypal.pages.inc
- uc_paypal_ec_submit in contrib/ubercart/payment/uc_paypal/uc_paypal.pages.inc
- uc_paypal_wps_form in contrib/ubercart/payment/uc_paypal/uc_paypal.module
- uc_product_features in contrib/ubercart/uc_product/uc_product.admin.inc
- Displays the product features tab on a product node edit form.
- uc_product_image_defaults in contrib/ubercart/uc_product/uc_product.admin.inc
- Set up imagefield and imagecache for products.
- uc_product_kit_buy_it_now_form_validate in contrib/ubercart/uc_product_kit/uc_product_kit.module
- Redirect to the product kit page so attributes may be selected.
See alsouc_product_kit_buy_it_now_form()
- uc_roles_deletion_form_submit in contrib/ubercart/uc_roles/uc_roles.admin.inc
- @see uc_roles_deletion_form()
- uc_shipping_make_shipment in contrib/ubercart/shipping/uc_shipping/uc_shipping.admin.inc
- Default method to send packages on a shipment.
- uc_stock_report_form_submit in contrib/ubercart/uc_stock/uc_stock.admin.inc
- @see uc_stock_report_form()
- uc_store_customer_search_form_submit in contrib/ubercart/uc_store/uc_store.admin.inc
- @see uc_store_customer_search_form()
- uc_taxes_clone in contrib/ubercart/uc_taxes/uc_taxes.admin.inc
- Clone a tax rate.
- uc_taxes_delete_form in contrib/ubercart/uc_taxes/uc_taxes.admin.inc
- Delete a tax rule.
See alsouc_taxes_delete_submit()
- uc_weightquote_admin_method_edit_form_delete in contrib/ubercart/shipping/uc_weightquote/uc_weightquote.admin.inc
- @see uc_weightquote_admin_method_edit_form()
- update_manual_status in core/modules/update/update.fetch.inc
- Callback to manually check the update status without cron.
- user_admin_role in core/modules/user/user.admin.inc
- Menu callback: administer roles.
See alsouser_admin_role_validate()
- user_login in core/modules/user/user.module
- Form builder; the main user login form.
- user_logout in core/modules/user/user.pages.inc
- Menu callback; logs the current user out, and redirects to the home page.
- user_pass_reset in core/modules/user/user.pages.inc
- Menu callback; process one time login link and redirects to the user page on success.
- user_register in core/modules/user/user.module
- Form builder; The user registration form.
See alsouser_register_validate()
- views_export_export_form_apply in contrib/views/views_export/views_export.module
- views_ui_ajax_form in contrib/views/includes/admin.inc
- Generic entry point to handle forms.
- views_ui_convert1 in contrib/views/includes/convert.inc
- Page callback for the tools - Views 1 convert page
- views_ui_disable_page in contrib/views/includes/admin.inc
- Page callback for the Views enable page
- views_ui_edit_view_form_cancel in contrib/views/includes/admin.inc
- Submit handler for the edit view form.
- views_ui_enable_page in contrib/views/includes/admin.inc
- Page callback for the Views enable page.
- xmlsitemap_bundle_settings_dialog in contrib/xmlsitemap/xmlsitemap.admin.inc
- _batch_finished in core/includes/batch.inc
- End the batch processing:
Call the 'finished' callbacks to allow custom handling of results,
and resolve page redirection.
- _ca_conversion_finished in contrib/ubercart/ca/ca.admin.inc
- Batch finalization function to hide the conversion tab.
- _print_pdf_wkhtmltopdf in contrib/print/print_pdf/print_pdf.pages.inc
- Generate the PDF file using wkhtmltopdf
- _uc_file_download_redirect in contrib/ubercart/uc_file/uc_file.pages.inc
- Send 'em packin.
Code
core/includes/common.inc, line 311
<?php
function drupal_goto($path = '', $query = NULL, $fragment = NULL, $http_response_code = 302) {
$destination = FALSE;
if (isset($_REQUEST['destination'])) {
$destination = $_REQUEST['destination'];
}
else if (isset($_REQUEST['edit']['destination'])) {
$destination = $_REQUEST['edit']['destination'];
}
if ($destination) {
$colonpos = strpos($destination, ':');
$absolute = ($colonpos !== FALSE && !preg_match('![/?#]!', substr($destination, 0, $colonpos)));
if (!$absolute) {
extract(parse_url(urldecode($destination)));
}
}
$url = url($path, array('query' => $query, 'fragment' => $fragment, 'absolute' => TRUE));
$url = str_replace(array("\n", "\r"), '', $url);
if (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update') {
module_invoke_all('exit', $url);
}
session_write_close();
header('Location: '. $url, TRUE, $http_response_code);
exit();
}
?>