ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Login redirect based on username

February 14, 2008 3:18pm

Subscribe [7]
  • #1 / Feb 14, 2008 3:18pm

    highervision

    18 posts

    I’ve got a “Client Login” form on a site I’m doing(client accounts created manually by the site admin). I’m creating each client page w/ the Pages Module. I would like the clients to login and get redirected to the page we’re creating for them.

    Is it possible to set the return parameter in the form to something like:

    return="/clients/{username}"

    where “/clients/{username}” is equal to the page I created for them.

  • #2 / Feb 25, 2008 7:44am

    purefusion

    29 posts

    Were you able to figure this out? I’m looking at doing something similar, but I have no idea how to approach it. I’m assuming I would create accounts for each client, or let them register (not sure how to send them to the registration page). Then would I assign them to a “clients” member group manually?

    On their page, I expect to list data specific to their projects. I’m assuming I would setup a weblog with fields pertaining to each project that would be posted. Would I create a category for each client, and then use that to filter out only posts specific to them? This is for something entirely different than backend access. Clients would only get frontend access.

    Not sure what code to use to:
    * setup the login form on the /clients/ page
    * redirect them to their “client dashboard” (/clients/client-name/) after logging in
    * provide a projects page (/clients/client-name/projects/)
    * feedback on projects (using comments most likley)
    * offer file upload/download capabilities (/clients/client-name/files/)
    * provide a resources page (/clients/client-name/resources/)

    Not sure how to approach the multiple tiers, or if it’s even possible. I’m open to all options.

    Anyone have any tips to point me in the desired direction?

  • #3 / Feb 27, 2008 5:37am

    Mark Bowen

    12637 posts

    Hi there,

    Not sure if this helps at all but I wrote up a method for re-directing users who are currently not logged-in to the system to a place of your choosing upon using the log-in form tag.

    Pretty sure it would work in your case?

    Hope that helps.

    Best wishes,

    Mark

  • #4 / May 23, 2008 7:25pm

    hothousegraphix

    851 posts

    @ highervision - were you able to figure out how to do this?

    The issue seems to be how to pass the input value for the “username” field to the return parameter.

    Marks method does work but it too experiences the same issues as simply trying to use the {username} variable in the return parameter of the login form tag - you get an “Invalid URI” message. The {username} variable is not recognized.

  • #5 / May 24, 2008 11:09am

    hothousegraphix

    851 posts

    I’ve attempted a number of different ways to grab this value - all trying to fetch the “username” value from POST.

    First I simply updated the return value of the login tag -

    return="/member_tempate_group/profile_template/<?php echo $_POST['username'];?></code></pre>
    Parsing on input.
    
    For good measure - and because I really have no idea what I'm doing :gulp:, I attempted GET as well.
    
    I receive no errors within my template but the page I'm redirected to returns an "Invalid URI" message.
    
    I then attempted Mark's cookie method (which works when redirecting to a specific url)... but, when I try:
    <pre><code><?php
    $user = $_POST['username'];
    setcookie("myCookie", "http://www.fashiondiner.com/members/echo $user;", "0", "/");
    ?> 
    // login tag
    {exp:member:login_form return="<?php echo $_COOKIE['myCookie']; ?>"}

    it returns a template error

    Notice: Undefined index: username in /home/fashiond/public_html/cms/core/core.functions.php(637) : eval()‘d code on line 15

    If I continue and submit the form, the redirect occurs but the dynamic segment of my url is empty (no errors occur) unlike my previous attempts which returns an “undefined variable username” message sandwiched between a long string of characters.

    Would anyone have some advice?

    Thanks.

  • #6 / Sep 09, 2008 9:31am

    judin

    54 posts

    Did you ever get this working?

    I’m trying the same thing at the moment!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases