I've set it so that the authenticated user sees text and "type" as "themed".

For some reason, whenever a user logs in it goes straight to his profile.
The home link works great, just would like it to be the default...

Anyone know where to change this?

Comments

Phillip Mc’s picture

Status: Active » Closed (fixed)
Marquis’s picture

Thanks for the reply, but I was kinda hoping to find some setting within this module or in the worst case a hardcoded alternative.

After reading my original post, I'm not sure I explained myself properly.

This only occurs right after logging in. If I reload the site root with an open session, then it loads the proper page set in Front_page admin.

So basically, I'd like users to be redirected to whatever page is set in the front_page as default right after loggin in...

Is this normal behavior?

Just dosen't feel like its not normal behavior.

Phillip Mc’s picture

the normal behaviour is that when a user logs in (using the login block for example), they are brought to the page they were just looking at. not the profile.

It sounds like you're directing users to login using the www.example.com/user/login link, which means they will always see their profile when they login.

Marquis’s picture

You're right.

I've put the login form for anonymous users which is posting to:

What else can I use so that users get sent to the authenticated front_page?

Phillip Mc’s picture

have you tried putting in a custom login form on your front_page for users not logged in?

e.g.

    <h2 class="title">User login</h2>
    <div class="content"><form action="front?destination=front_page"  accept-charset="UTF-8" method="post" id="user-login-form">
<div><div class="form-item">
 <label for="edit-name">Username: <span class="form-required" title="This field is required.">*</span></label>
 <input type="text" maxlength="60" name="name" id="edit-name"  size="15" value="" class="form-text required" />
</div>
<div class="form-item">
 <label for="edit-pass">Password: <span class="form-required" title="This field is required.">*</span></label>

 <input type="password" name="pass" id="edit-pass"  maxlength="60"  size="15"  class="form-text required" />
</div>
<input type="submit" name="op" id="edit-submit" value="Log in"  class="form-submit" />
<div class="item-list"><ul><li><a href="/user/register" title="Create a new user account.">Create new account</a></li><li><a href="/user/password" title="Request new password via e-mail.">Request new password</a></li></ul></div><input type="hidden" name="form_id" id="edit-user-login-block" value="user_login_block"  />

</div></form>
</div>

note the form action="front?destination=front_page" which tells Drupal to log this person in and bring them to the front_page.

Marquis’s picture

Hi,

I've tried your example and it works great. I've tried just changing the

I did strip down some css, to comply with the one I made. So I'm guessing I removed something I shouldn't have.

I can't seem to put my code here... here is a link to pastebin

http://pastebin.ca/987804

Can anyone see what my noob brain is doing wrong?

gsutcliffe’s picture

I needed a similar solution last week and all that was needed was to use the form_alter hook. Basically just hook into the login and add the redirect property, Drupal will do the rest:

function hook_form_alter($form_id, &$form) {
	if ($form_id == 'user_login_block' || $form_id == 'user_login') {
		$form['#redirect'] = '<location_here>';
	}
}

I didn't do this with front_page, but the redirect will take any alias.

Phillip Mc’s picture

I've tried your example and it works great. I've tried just changing the http://pastebin.ca/987804 Can anyone see what my noob brain is doing wrong?

It wasn't obvious glancing at the pastebin code why it wasn't working for you..i notice your form action was <form action="/user" which directs the user to their profile page when they login which is what you didn't want.

A simple and quick way of doing it if your site is already translated, is to try this:

(a) temporarily enable the login block, logout of your site and visit your front_page.
(b) Click on view source to grab the source HTML for your login form.
(c) login, disable the login block and use the snippet in your front_page settings.

martin_q’s picture

@gsutcliffe re: #7

I have now solved this problem by installing the 6.2 version of login_destination. But I did originally try your hook form alter solution, but couldn't get it to work. Could you elaborate a little on where I would need to put it, and what else would need to change? Thanks.