redirect on login to members page

Permalink 1 user found helpful
I got this code from the forum that I put in my template (default.php). Everything works great, I get a log out and a message area, but I would like to redirect to my members only page rcID-70 when members log in. Of course on log out members would return to homepage because the members area is not visible unless logged in.

I've searched the forum and tried several different suggestions but can't get any of them to work.

I don't know php and don't know how or where to put it in the below code block so members would be redirected to the members page when they log in.

Please help. Thank you.

<h2>Members<span>Login</span></h2>
<?php            global $u; 
if ($u -> isLoggedIn ()) { 
; ?>
<?php
echo ' <form class="login_block_form" method="post" action="/index.php/login/-/logout">'; 
echo ' <h4>You Are Logged In</h4> '; 
echo ' <input type="submit" class="ccm-input-submit" id="submit" name="submit" value="Sign out &gt;"  />    </div>    ';
echo ' </form>    '; 
} else { 
?>
<?php            
echo '<form class="login_block_form" method="post" action="/index.php/login/-/do_login/">'; 
echo '    <div class="loginTxt"></div> '; 
echo '    <div class="uNameWrap"> ';

 
Tony replied on at Permalink Best Answer Reply
Tony
we're discussing adding an option to the dashboard so you can specify where you want a user to be redirected to after login, but in the meantime try this. Over-ride you c5root/concrete/controllers/login.php file by copying it to c5root/controllers/login.php, and then within the finishLogin() method, replace this: $this->redirect('/'); to point to where-ever you want to go after login.
ewc07 replied on at Permalink Reply
That worked.

Thanks
msouden replied on at Permalink Reply
msouden
This would be greatly help UI for a project I'm on where there is a simple protected area with one login that is passed out for materials download.

Right now There's a login block on a page that returns them to... a login block. Some users have missed the additional page(s) added to the nav. I'd love to land them there.

I'm pretty sure the above won't work for me because I'm using the login block elsewhere on the site with different user permissions - so they need different landing pages.

Instance-specific landing for the login block would be ideal.

Any ideas on how to achieve this?
Tony replied on at Permalink Reply
Tony
It would be cool to have the login block let you choose where you want to redirect after login. But in the meantime, you can do this by creating a custom template for the block. Copy the login block's view.php to c5root/blocks/login/templates/yourTemplateName.php

And then add the query string variable rcID (containing the url or the collection ID that you want to redirect to) to the form action property.
rgwinwood replied on at Permalink Reply
Anyone have a ballpark timeframe on when such a revision of the login block might be completed? I have an (urgent?)need to redirect after login to a member landing page (gotta love deadlines!).

Also, does anyone know if there is a limit to the number of users/logins you can have? I will probably eventually need the site to handle 300+. Is that going to be a problem for me?
griebel replied on at Permalink Reply
griebel
No limits on user accounts, I have a site running with 9.000+ members.

I have changed the login template as Tony suggested, so users are redirected to a special area / forum.
rgwinwood replied on at Permalink Reply
Cool...good to know that there's really no limit to number of users. Thanks!
Tony replied on at Permalink Reply
Tony
the upcoming release of concrete5 will include the ability to set where the user is redirected to after login (home, their profile page, or a custom page). not sure when the next release is scheduled though (especially since we just did a release).

In the meantime, you can override /concrete/controllers/login.php, and within the finishLogin() method, do something like this:

$this->redirect( '/profile/', $u->uID );
rlvargas replied on at Permalink Reply
May I suggest to add this functionality based on groups as well?

It would be great to be able to assign a group to a specific landing place.
dancer replied on at Permalink Reply
dancer
Hey.
Sorry to bump such an old thread but I just wanted to pick up from where this left off.

I want a client user to login (using the login block if need be) and be redirected to a certain page. I know that now in C5 you can specify a custom page but this would affect all my users. is there anyway of redirecting a certain group or a user with a specfic attribute to a certain page?

Tony mentioned:
"And then add the query string variable rcID (containing the url or the collection ID that you want to redirect to) to the form action property."

I am not quite sure what this means though.

Thanks in advance.

EDIT:

Have just posted this response I found this thread:
http://www.concrete5.org/community/forums/customizing_c5/page-redir...

Incase anyone else comes across this one :)
Steevb replied on at Permalink Reply
Steevb
Not with out paying for it.........
dancer replied on at Permalink Reply
dancer
I cracked it.
But thanks for your helpful response
zoinks replied on at Permalink Reply
how did you accomplish it?
emmapike31 replied on at Permalink Reply
Can I ask how you cracked it to allow users to login and get directed to a particular page for their group as I'm trying to do this too and don't want to pay $75 to do it!

thanks
emma