EllisLab text mark
Advanced Search
     
Two questions on login form (not redirecting and username tag)
Posted: 25 June 2012 07:57 AM   [ Ignore ]
Avatar
Joined: 2009-11-04
138 posts

I’m using the following code to allows users to log in:

{exp:member:login_form return="{homepage}"}
<p></p><label>Username</label><br />

<
input type="text" name="username" value="" maxlength="32" size="25"></p>
    
<
p></p><label>Password</label><br />
<
input type="password" name="password" value="" maxlength="32" size="25"></p>
    
{if auto_login}
<p><input type="checkbox" name="auto_login" value="1"> <span>Auto-login on future visits</span></p>
{/if}

<input type="submit" name="submit" value="Submit"></p>
<
p><a href="{path='member/forgot_password'}">Forgot your password?</a></p>
    
<
p><a href="{path='member/register'}">Need an account?</a></p>
{/exp:member:login_form} 

I’ve got two problems… after the user logs in, they get the “Thank you, you are now logged in” screen. However it just sits there and never redirects to the home page. I’ve tried both return=”{homepage}” and “return=‘main/index’” (which is the main site page. Neither works… the thank you page just sits there forever.

The other issue I’m having, also on the “you’re logged in” page is that the {username} tag doesn’t work. I have a page header that says “Hello Jason” (for example), but when sitting on the “you’re now logged in page” it says “Hello {username}” and doesn’t parse the tag. On all other pages, it works fine.

Thoughts?

 Signature 

My biz: http://turcottedata.com
Follow me on Twitter: http://twitter.com/jasonturcotte

 
Posted: 26 June 2012 10:42 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2005-10-18
7340 posts

Hi Jason,

Let’s see if we can get this sorted out!

What version of ExpressionEngine are you using? Are you removing index.php?

One the unparsed {username} variable, those templates are run through a special parser. The side effect of that is some variables aren’t available.

You might look into something like Freemember to break these template out and gain access to more functionality.

Cheers,

 Signature 

How may I help you?

 
Posted: 26 June 2012 12:11 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2003-01-07
693 posts

We use this to help get folks back to the page they were on when they logged in. The global_url is a global variable we set that has the domain in it.

{exp:member:login_form return='{global_url}{if segment_1}{segment_1}/{/if}{if segment_2}{segment_2}/{/if}{if segment_3}{segment_3}/{/if}{if segment_4}{segment_4}/{/if}{if segment_5}{segment_5}/{/if}'

The the other issues you are having make me wonder if perhaps the template’s “type” might be set to something other than “webpage” as that might cause the other issues. Might be a good thing to rule out.

Hope this helps in getting your project back on track.

 Signature 

learn more at eeSiteKit.com


NetRaising | a web services company


Custom Designed Dynamic Websites for Mission Driven Organizations