I built a custom front page on my site using a Book Page node and set it as the front page in site configuration. My problem now is that the standard login block doesn't work on the front page. It still works correctly on every other page. When you enter login credentials in the block on the front page, the page reloads and nothing else happens, regardless of whether you enter correct credentials or not. I do have iTweak Login and Login Destination modules, but disabled them during troubleshooting and got the exact same results. No other modules should be affecting the login block as far as I know.

Any suggestions would be greatly appreciated!

Comments

nevets’s picture

How did you make the book page the front page?

Are you using a custom page.tpl.php file?

eljakeo’s picture

I just gave the book page a path of /home and then went to admin > config > system > site-information and changed the "Default front page" to home.

I do have both a page.tpl.php and a page--front.tpl.php. However, during troubleshooting I changed over to the default Garland theme (because I had read that you can cause this problem through your theme) and still had the exact same problem.

nevets’s picture

Are you placing the block using the block admin page?

eljakeo’s picture

Yes.

eljakeo’s picture

I tried using a Panel page instead of a Book Page and it made absolutely no difference.

eljakeo’s picture

Well, I fixed it but I'm not sure why my fix actually worked. I had set the path for the page node to "home". I just changed the path to "front" instead and that made it work. No clue why, but there it is.

RollWhisTler’s picture

Hello eljakeo... i have the same problem, user login block doesn't actually log in anything :p.

I had front page path url set to home, so when i had read your post i thought, lol! that's it!... but no, i changed it to front and still not working... actually it doesn't work anything except from /user/login :(.

I set it using the core structure/blocks menu, visible on all pages...

any ideas? :_)

mgzrobles’s picture

I suffer the same issue.
the problem was in the $form['#action'] that produces for some reason a 404 error.
I emptied this variable and created a custom submit to redirect the user.

the code:

/**
 *
 * Implementation of hook_form_alter().
 */
function room_booking_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id === 'user_login_block') {
    // custom submit to make something like redirect.
    $form['#submit'][] = 'user_login_block_custom_submit';
    /*
     *  don't know the reason why the login block in the homepage not work if this homepage have a custom path.
     *  if you get empty the $form['#action '] you can get that it work.
     */
    $form['#action'] = '';

  }
}

/**
 * user_login_block Form submit.
 * Redirect to the page where you made the submit action.
 *
 * @param $form
 * @param $form_state
 */
function user_login_block_custom_submit($form, &$form_state) {
  drupal_goto($_GET['q']);
}
lukedekker’s picture

I was having a similar issue. I have a custom 403 page that is an emptypage callback. If a user tries to visit a restricted page, they are prompted to login. The problem, was that when a user submits the form, it just takes them to the 403 emptypage and they are not logged in. The problem is that I was adding the user login block to the 403 page, and not the page callback. (Even though the user is trying to visit "user/*/" which is what shows in the address bar, they are technically on "emptypage/" the form was attached to the 403 page response, but not the 403 emptypage itself. Meaning when the user submitted the form, the form was submitted through a page on which the form did not exist. Causing the browser to just reload the page. To fix, all I had to do was add the user login block to the emptypage as well as the 403 page.

Hope this helps!

UksusoFF’s picture

Same trouble :/ Empty action in THEME_NAME_form_user_login_block_alter also work's for me.