Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Redirect user after logout programmatically

This is how you use the hook_user_logout to implement a redirect in Drupal 8. For implementing a redirect in Drupal 8, we can do it using the hook_user_logout() /** * Implements hook_user_logout(). */ function mymoduler_user_logout() { // we redirect to an external site $response = new RedirectResponse("https://www.google.se"); $response->send(); return $response; } Remember to include the library: use \Symfony\Component\HttpFoundation\RedirectResponse;
Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web