0

Why Drupal 7 cannot redirect properly (I've logged in)?

When I'm trying to call drupal_get_form('user_login') from my module in hook_preprocess_page(), the browser throw that message.

Thank you!

Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105
No Mess
  • 1
  • 1
  • Welcome to stackoverflow. Please read the FAQ (http://stackoverflow.com/faq). You will need to provide more details if you want someone to answer. In this case, you didn't specify what message you're referring to. – Jay Sullivan Jun 22 '12 at 02:34

2 Answers2

0

Drupa_get_form() function is not for redirecting. It is for getting a form. In your case, you are calling the login form. To redirect, use the drupal_goto() function here is a link on the drupal api http://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_goto/7

4life
  • 196
  • 4
  • 10
0

Well, drupal_get_form('user_login') causes the issue. So instead of drupal_get_form('user_login') use drupal_get_form('user_login_block') and it will work.

Umesh Patil
  • 4,668
  • 32
  • 24