Page 1 of 2

Frontend user (FEU) can not login

Posted: Tue Jan 08, 2013 7:02 am
by BaukeJ
Hi,

I am using FEU in combination with Eventmanager. By registering a user can suscribe to an event (in my case a course).
This all goes well. A user registers, gets an activation link, activates and is logged in. After that he or she can suscribe.
The user is automaticaly logged out after 1800 seconds.

Now gets the tricky part. If a user returns to the page and would like to login with his user data, that doesn't work. After loging in with the right credentials, the only thing that happens is that the user is being redirected to the previous page.

I really don't know whats happening and could use all the help there is.

If you would like to try, login to http://baukejonkmans.nl/events/7/94/Bas ... dagen.html with un: bauke.jonkmans@gmail.com and pw: testuser

Thank you for your help!

Re: Frontend user (FEU) can not login

Posted: Thu Jan 31, 2013 12:28 am
by Dr.CSS
Looks like you fixed it, FEU has a couple ways of redirecting after login, one is set in FEU admin, the other is set in the tag, both are mentioned in the Help...

Re: Frontend user (FEU) can not login

Posted: Thu Jan 31, 2013 7:49 am
by BaukeJ
Hi Dr. CSS,

Thanks for taking a look. Unfortunately it is not fixed. What actually happens when you login (at this moment) is that the page redirects to the parent page (/kalender). What should happen is that the user stays on this page, but is able to register.

I used this tag {FrontEndUsers form="login"} and have not set a redirect in the FEU admin.

Do you have any idea what could be wrong?

Re: Frontend user (FEU) can not login

Posted: Fri Feb 01, 2013 6:46 pm
by Dr.CSS
I don't quite follow what you want and what is not working, a little more detail with step by step walk thru of what should happen...

Re: Frontend user (FEU) can not login

Posted: Fri Feb 01, 2013 10:16 pm
by psy
The detail page URL is a constructed route. After login, the user is redirected back to /kalendar as that is the real page.

Try capturing the URL route and then put that in the FEU tag as the redirect to location.

Re: Frontend user (FEU) can not login

Posted: Mon Feb 04, 2013 11:53 am
by psy
If my previous comment doesn't work, try the following. I've used it in a few instances and it seems to work OK.

In your detail template, capture the constructed URL, eg if you have CGExtensions and CGSimpleSmarty installed:

Code: Select all

{session_put var=detailurl value=$cgsimple->self_url()}
In your summary ('/kalendar') template put:

Code: Select all

{if $ccuser->loggedin() and !empty($smarty.session.detailurl)}
{assign var='redirecturl' value=$smarty.session.detailurl}
{session_erase var='detailurl'}
{redirect url=$redirecturl}
{/if}

What it does is:

1. On the detail page, when the user logs in, it saves the constructed URL to a session var.
2. Once the user is logged in, by default it returns to the /kalendar summary page template.
3. That template checks to see if the session var 'detailurl' exists and if so, assigns it to a local var, erases the session var then automatically redirects back to the detail page with the correct URL.

hth
psy

Re: Frontend user (FEU) can not login

Posted: Mon Feb 04, 2013 12:19 pm
by BaukeJ
Hi Psy,

Thank you for your suggestions.

Just one question. Can you tell me what the best way is tot capture the URL route?

Aside from that, is that; won't the URL route be different for every event?

As for the alternative you mentioned (changing the template). Where to place the first code you gave?

Re: Frontend user (FEU) can not login

Posted: Mon Feb 04, 2013 9:12 pm
by psy

Code: Select all

{session_put var='detailurl' value=$cgsimple->self_url()}
goes in your detail template.

It will capture the route URL and put in into a session var called 'detailurl'. You can then test for $detailurl in the summary template.

Re: Frontend user (FEU) can not login

Posted: Mon Feb 04, 2013 9:23 pm
by psy
Yes, the route URL will be different for every event which is what is captured by $cgsimple->self_url(). It gets the route URL as displayed in the browser for each event detail page.

Once saved, the 2nd part of the code will take the user back to the same event detail page they were on when they logged-in.

Re: Frontend user (FEU) can not login

Posted: Tue Feb 05, 2013 7:31 am
by BaukeJ
Hi Psy,

Thank you. I succesfully put

Code: Select all

{$session_put var='detailurl' value=$cgsimple->self_url()}
in my event detail template. (Couldn't make it work without the $ preceeder.

Now i tried to add

Code: Select all

{if 
$ccuser->loggedin() and !empty($smarty.session.detailurl)}
{assign var='redirecturl' value=$smarty.session.detailurl}
{session_erase var='detailurl'}
{redirect url=$redirecturl}
{/if}
In the summary template (/kalender). Unfortunately this calls for the following error when calling for /kalender:
string(142) "Smarty error: [in module_db_tpl:EventsManager;summary_Custom line 5]: [plugin] unknown tag - 'session_erase' (core.load_plugins.php, line 198)" string(154) "Smarty error: [in module_db_tpl:EventsManager;summary_Custom line 5]: syntax error: unrecognized tag 'session_erase' (Smarty_Compiler.class.php, line 590)" string(137) "Smarty error: [in module_db_tpl:EventsManager;summary_Custom line 6]: [plugin] unknown tag - 'redirect' (core.load_plugins.php, line 198)" string(149) "Smarty error: [in module_db_tpl:EventsManager;summary_Custom line 6]: syntax error: unrecognized tag 'redirect' (Smarty_Compiler.class.php, line 590)"
Do you have any suggestions on how to handle this?

Re: Frontend user (FEU) can not login

Posted: Tue Feb 05, 2013 7:39 am
by psy
As mentioned in my original post with this method, you need CGExtensions and CGSimpleSmarty installed.

{$cgsimple->self_url()} , {session_erase} and {session_put} are CGSimpleSmarty tags.

Re: Frontend user (FEU) can not login

Posted: Wed Feb 06, 2013 6:54 am
by BaukeJ
Hi Psy,

Thank you for your answer and patience. I diden't read your post well enough.
I succesfully installed the CGSimpleSmarty module, added the code to the summary page /kalender and deleted the $ preceeder in your code for the detail event page.

When calling for /kalender, it generates the following faillure (with debugging on)
string(137) "Smarty error: [in module_db_tpl:EventsManager;summary_Custom line 5]: [plugin] unknown tag - 'redirect' (core.load_plugins.php, line 198)" string(149) "Smarty error: [in module_db_tpl:EventsManager;summary_Custom line 5]: syntax error: unrecognized tag 'redirect' (Smarty_Compiler.class.php, line 590)" Notice: Undefined index: ccuser in /home/vhosting/j/vhost0039238/domains/baukejonkmans.nl/htdocs/www/tmp/templates_c/EventsManager^%%30^30E^30E6A6B8%%module_db_tpl%3AEventsManager%3Bsummary_Custom.php on line 5 Fatal error: Call to a member function loggedin() on a non-object in /home/vhosting/j/vhost0039238/domains/baukejonkmans.nl/htdocs/www/tmp/templates_c/EventsManager^%%30^30E^30E6A6B8%%module_db_tpl%3AEventsManager%3Bsummary_Custom.php on line 5
I tried your code also with "redirect_url" instead of "redirect url" but that doesn't seem to work either.

Do you have any suggestions?

Again, your help is very much appreciated. Thanks for that!

Re: Frontend user (FEU) can not login

Posted: Wed Feb 06, 2013 7:29 am
by psy
Oops, I should have checked Extensions->Tags to get the correct syntax which is:

{redirect_url to=$redirecturl}

Note: The $ sign is necessary to let Smarty know it's a var within a tag.

Re: Frontend user (FEU) can not login

Posted: Wed Feb 06, 2013 11:01 am
by BaukeJ
Hi Psy,

Thanks. I made the changes and there seems to happen something, thats possitive ;-) The other side is that there seems to be another faillure:
Notice: Undefined index: ccuser in /home/vhosting/j/vhost0039238/domains/baukejonkmans.nl/htdocs/www/tmp/templates_c/EventsManager^%%30^30E^30E6A6B8%%module_db_tpl%3AEventsManager%3Bsummary_Custom.php on line 5 Fatal error: Call to a member function loggedin() on a non-object in /home/vhosting/j/vhost0039238/domains/baukejonkmans.nl/htdocs/www/tmp/templates_c/EventsManager^%%30^30E^30E6A6B8%%module_db_tpl%3AEventsManager%3Bsummary_Custom.php on line 5
Does this sound familiar to you and do you know how I can fix it?

Re: Frontend user (FEU) can not login

Posted: Wed Feb 06, 2013 11:18 am
by psy
Doh! FrontEndUsers and CustomContent are so closely intertwined I forgot that they are separate modules. It's almost second nature to install both.

$ccuser is a CustomContent module object. Install the CustomContent module and read the help text.

Also check the FEU help.