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.

Solution For Redirection After Registration

March 23, 2010 2:13am

Subscribe [6]
  • #1 / Mar 23, 2010 2:13am

    Deep Arora

    153 posts

    I was struggling to find a solution for redirecting users after registration. Read few threads, found a $99 solospace plugin too..ouch!

    Then finally made a small change in a core file and bingo!

    Not sure if someone has already done this, but if not, you may find it useful.

    Making this small change in one of the core file allows you to redirect user to immediately after registration to any page you desire.

    Open the file “system\expressionengine\modules\member\mod.member_register.php

    Search for this line:

    'content'    => $this->EE->lang->line('mbr_registration_completed')."\n\n".$message,

    Just below this line, you will see a line as:

    'redirect'    => '',

    Change it to this:

    'redirect'    => $this->EE->db->escape_str($_POST['RET']),

    Now, in your EE registration form template,

    <form id='register_member_form' method="post" action="http://yoururl.com/anytemplate"  >
    <input type="hidden" name="XID" value="{XID_HASH}" />
    <input type="hidden" name="ACT" value="7" />
    <input type="hidden" name="RET" value="http://yoururl.com/anytemplate" />
    <input type="hidden" name="FROM" value="" />

    In the RET field, give any URL where you want to redirect the user to.

    Hope this helps.

    Thanks.

  • #2 / Mar 23, 2010 11:15pm

    lebisol

    2234 posts

    Cool, it would be nice if it was dynamic grabbing the last URL prior to register page and then redirect back.
    Thanks for sharing!

  • #3 / Mar 23, 2010 11:28pm

    Deep Arora

    153 posts

    I guess that is easy with something like this:

    'redirect'    => $_SERVER['HTTP_REFERER'],

    though I didn’t try it, but this should work..

  • #4 / Mar 24, 2010 1:49am

    lebisol

    2234 posts

    😊 yeah I just realized that it can be a php EE template.
    Nice.

  • #5 / May 18, 2010 8:13am

    redfred

    141 posts

    How do you get swap this bit of code on the registration template, as it isn’t actually on the template when you go to edit:

    <form id='register_member_form' method="post" action="http://www.mysite.com/index.php"  >
    <div class='hiddenFields'>
    <input type="hidden" name="XID" value="70675c296dc8e450a12c14e92ab4d580496c9149" />
    <input type="hidden" name="ACT" value="7" />
    <input type="hidden" name="RET" value="http://www.mysite.com/index.php" />
    <input type="hidden" name="FROM" value="" />
    <input type="hidden" name="site_id" value="1" />

    Thanks

  • #6 / Jun 27, 2010 8:37pm

    koala kid

    72 posts

    Thanks for the tip, I’ve just been struggling with the same issue myself.

    For anyone who has had to enable “Force URL Query Strings” via the control panel you have to remove the string clearing function, not as secure but still works:

    'redirect'  => $_POST['RET'],

    I’m not sure why this is not enabled by default though as they provide a RET parameter to the form, why leave it empty in the registration script? Bug?

  • #7 / Jun 29, 2010 9:09pm

    lebisol

    2234 posts

    For those looking to take it step further consider this article and extension for extending member templates.

  • #8 / Jul 08, 2010 4:07pm

    Elemento, Inc.

    57 posts

    i replaced it with:

    'redirect'  => $_POST['RET'],

    tested and working. thanks for pointing me to the direction.  that $99 plugin was tempting though.

    I used the form in this template: http://expressionengine.com/wiki/Standalone_Registration_Form/

    thanks again!

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

ExpressionEngine News!

#eecms, #events, #releases