• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Front End User - redirect after login
PostPosted: Fri Jul 03, 2020 3:59 pm 
Offline
Forum Members
Forum Members

Joined: Mon Nov 26, 2018 3:09 pm
Posts: 89
Hi. I'm sure this must have been covered somewhere but I cant find anything...

How do I redirect to a page after login? Default set up is for FEU to stay on the same page and just replace the login form with a 'login successful' message. What I need to do is redirect to a protected page...

The help file gives this as an example:

\$1:
{if !empty($final_message)}
    {cms_selflink href='members' assign='members_page_url'}
    {redirect_url to=$members_page_url}
{else}
something else
{/if}


I cant get this to work though?! I'm assuming it goes in the page template - I've put under the {FrontEndUsers} tag in my page template

This must be something simple ... please help me :)

Thanks!


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Front End User - redirect after login
PostPosted: Fri Jul 03, 2020 4:45 pm 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 3233
Location: The Netherlands
I think you should put that logic in the assets/module_custom/FrontEndUsers/templates/orig_loginform.tpl

If that folder and file don't exist yet create the folder structure and copy the orig_loginform.tpl file from /modules/FrontEndUsers/templates/orig_loginform.tpl

https://docs.cmsmadesimple.org/customiz ... -templates


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Front End User - redirect after login
PostPosted: Fri Jul 03, 2020 5:15 pm 
Offline
Forum Members
Forum Members

Joined: Mon Nov 26, 2018 3:09 pm
Posts: 89
Thanks Velden - I will take a look

If anyone can advise a way of doing within page template that would be good


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Front End User - redirect after login
PostPosted: Fri Jul 03, 2020 5:33 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Feb 25, 2009 4:25 am
Posts: 986
Location: Victoria, BC
Velden's suggestion is probably best, but if you need it in the page template you can always change the {if} part to check for something that's available to it, something like (not tested):

\$1:
{$uid=feu_smarty::get_current_userid()}
{if $uid > 0}
  {redirect_page page='your-page-alias'}
{/if}

_________________
Not getting the answer you need? CMSMS support options


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Front End User - redirect after login
PostPosted: Fri Jul 03, 2020 7:55 pm 
Offline
Forum Members
Forum Members

Joined: Mon Nov 26, 2018 3:09 pm
Posts: 89
Cool thanks - will look at that


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Front End User - redirect after login
PostPosted: Mon Jul 06, 2020 11:35 am 
Offline
Forum Members
Forum Members

Joined: Mon Nov 26, 2018 3:09 pm
Posts: 89
ok, I've tried placing the following code (taken from the help file)
\$1:
in the login form.tpl as a test

\$1:
    {if !empty($final_message)}
    I'm going to redirect you
{else}
Error
{/if}


However ... it doesnt seem to work - I get the else statement run ie the word 'error' displays after logging in

So I tried
\$1:
    {if !empty($user_info->id > 0)}
    I'm going to redirect you
{else}
Error
{/if}


which does seem to work. I'm not sure why the method from the help file doest work... is there any reason I cant use my modified method above? And if not, then posting this in case its useful to someone else!


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Front End User - redirect after login
PostPosted: Mon Jul 06, 2020 12:37 pm 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 3233
Location: The Netherlands
I'd consider changing (and testing):
\$1:
{if !empty($user_info->id > 0)}


into:
\$1:
{if $user_info->id > 0)}


Alternatively:

\$1:
{if !empty($user_info) && $user_info->id > 0)}


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Front End User - redirect after login
PostPosted: Mon Jul 06, 2020 12:40 pm 
Offline
Forum Members
Forum Members

Joined: Mon Nov 26, 2018 3:09 pm
Posts: 89
Thanks Velden - will test


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting