Search

Hi all !

I have written my own event to control user identification on front end.

My problem is that when user is identified, I would like him to be redirected on another page using the 'redirect()' method.

The problem is doing that way implies loosing my XMLElement returned by my '__trigger()' method where are stored messages for logged in user.

I thought about not using 'redirect()' but in this case, the 'Current User' data source returning currently logged in user returns nothing. So all my front end operation using result of this data source to detect if user is logged in and select what to display don't work. It looks like data sources are loaded before events are executed. Do you confirm ?

Thanks for any help.

You will have to run the event on each page to get the current user info. I have a similar problem, and I use javascript to redirect instead.

Thanks for your answer Pat but I don't understand what you mean by running the event on each page. I don't use any event to get user information. To load user information, I am using a data source, in fact the same as the one delivered with sample website called 'User Logged In'. My event is used only for user identification to log in user with information input in login form.

Sorry, I'm not familiar with that setup. Could you explain what the event is for if you already have the user data in a Symphony section?

I think what bgillet is talking about is maintaining the event response data across a page refresh, using transient session data.

I brought this up as an issue recently with the way Symphony uses sessions, and the fact we have no 'flash' or 'transient' data; It's either all or nothing in the session, with a single expiry time and no temporary storage.

To battle this, Nils and Michael came up with the Storage extension, which I tested with them to see if fit my needs for the above use case. While not maintaining an event response, data can be pulled from it and added to the session from a custom event, so it helps some of the way.

My initial idea was to have an event filter that allowed the event's response to be session based, until a post field dropped it. Current session handling and my lack of available time makes this difficult to implement.

Unfortunately, we are more or less closed for new features on the 2.x codebase, although if I can come up with a better session management system (doubtful though) I would be happy to continue the codebase to include it.

Not sure if I understand your issue correctly. But I have been setting my redirect URL in my event by useing $_REQUEST = '/pageToRedirectTo/'

This way the user will be redirected once the event is completed

But it will not maintain the event's response XML data.

@designermonkey : You got the point ! That is exactly what I want to do : keeping my event's response XML data alive after an http redirect (that's how works the redirect() if I well understood). You suggest using session to store data and then retrieving them from the session from pages where I need them. I think there is a security issue doing that way because once data are saved into the session, they will remain until you specifically remove them. Problem is that we are human and we (often) forget to do such things. If you have some code running and using these data only in specific situations, you may have incorrect behavior because you forgot to delete data and your other code will not behave as expected.

May I suggest another way doing it ? What do you think about changing the way 'redirect()' method works ? We may have another redirect method not using HTTP redirect (or javascript) but acting like if symphony core received another URL loading request from the client but simulated on server, not really received from client. I mean it seams there is a path in the way data sources, events, pages, etc, are loaded and executed. In my opinion, as long as pages are not rendered, we may restart this path but for the url to redirect to keeping in memory data from the previous run.

What do you think about it ?

!!! UP !!!

No other workaround to suggest to solve my problem ?

Thanks

!!! UP !!!

You shouldn't do this, please.

Sorry. I didn't want to be rude.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details