After we login we are redirected to the user.module where the registered user could change it's user settings.
I think it's better to let an admin choose which page should be displayed here so we could make (for example) a node where the user could read what the difference is between logged-in and not logged in or display another module like the book.module for example.

* just like the 'begin'-link on the front page is configurable..

Comments

moshe weitzman’s picture

In many cases, you are logged back into the page which you are trying to view. So if you you go to a forum home page, and login using the login box from there, you arrive right back at forum home page, this time as a logged in user. So this request only applies to the case when you login from the actual login page (i.e. ?mod=user)

Stefan Nagtegaal’s picture

Priority: Major » Normal

Yes, that's right...

drumm’s picture

Component: User system » other

Setting status to won't fix.

Stefan Nagtegaal’s picture

MArking as active and currently rolling a patch...

analogduck’s picture

Yay! This is a feature I've been wanting to see. Anybody care to post a hack work-around I could use until then? I've been searching and searching through the code for the right item to edit. I imagine it's got to be in user.module, and I've tried several spots, but failed. :P

Clues always welcome! =)

-- Sean

analogduck’s picture

Title: Page after login should be configurable » How to hack the page after login to direct to your desired node

I figured out the hack to hardcode a different page as a work-around until the functionality is integrated in Drupal. I wish I was smart enough to do the job correctly, but I'm still only vaguely familiar with the Drupal code.

The line numbers referenced in the following notes are from user.module,v 1.407 2004/10/18 18:29:15.

Originally I thought that it was in the user_block section of the user.module, between line numbers 498 and 508:

          // Save the referer.  We record where the user came from such
          // that we can redirect him after having completed the login form.

          if (empty($edit)) {
            $edit['destination'] = $_GET['q'];
          }
          // NOTE: special care needs to be taken because on pages with forms,
          // such as node and comment submission pages, the $edit variable
          // might already be set.

          $output .= form_hidden('destination', $edit['destination']);

However, changing the above code did not yield any visible results upon logging in. The correct spot was in the user_login section between lines 817 and 820:

  // Save the referrer.  We record where the user came from such that we
  // can redirect him after having completed the login form.

    $edit['destination'] = 'node';

I changed:

  if (empty($edit)) {
    $edit['destination'] = 'node'];
  }

to:
$edit['destination'] = 'node';

Yes, I know it's ugly, it's evil, and it breaks the functionality whereby you could login and remain on the same page. However, for the site I was building, I just needed every logged in user to go to a specific page upon logging in every single time, which was necessarily different from the home page of the site. So, as improper as my hack was, it got the job done. I'm looking forward to seeing this feature rolled into the Drupal package properly though. =)

analogduck’s picture

Accidentally hit submit when I meant to hit preview. Sorry, I pasted the wrong version of the code when referencing lines 817-820. The correct lines of code in the un-hacked user.module are:

  // Save the referrer.  We record where the user came from such that we
  // can redirect him after having completed the login form.
  if (empty($edit)) {
    $edit['destination'] = $_GET['q'];
  }
  $output .= form_hidden('destination', $edit['destination']);

It drives me crazy that I can't edit my own comments in the case of errors like this. :P

catch’s picture

Version: » 6.x-dev
Status: Active » Closed (won't fix)

logintobboggan does this now.

moshe weitzman’s picture

more simply, try login_destination.module