Search

Is there anyway for an event to access output params from one of my datasources?

I want to avoid using hidden form fields

Events are executed before datasources, therefore no. That doesn't mean there isn't a solution, what's your use case?

No way. Events are executed before datasources. Hidden form fields is the way to send data.

Thanks for quick reply guys.

Just to answer the case: It's being applied to a comment section. Two types of user can comment, members (extension) and I have a section called author profile. I'm trying to access the author profile ID. I've messed around with adding params via DS but as you point out DS execute after events.

There's a few reasons for separate author profile, one being not all authors have CMS access.

My current solution is to make a few checks in the event. I was really looking for a more elegant way of storing some key data for easy access.

I think the data you need is already available in the param pool, even before datasource execution. Would you mind dumping Symphony::Engine()->Page()->_param inside your event and take a look yourself?

Hi alpacaaa, I can't see any ds-params in the dump, only ones set up by Symphony.

hmm maybe you can pass the author profile ID along with the form as a hidden param?

I can't see any ds-params in the dump, only ones set up by Symphony.

Indeed, but if what you're looking for is the author name and the currently logged in member id, they should be there.

Indeed, but if what you're looking for is the author name and the currently logged in member id, they should be there.

It's not the system author I'm looking for. I created a section called author profile. I'm looking for the ID of this section.

@gunglien by hidden param, do you mean hidden field?

yes hidden field - with the value inside obviously - sorry for not being clear.

This would work in most cases - if you can afford to pass the value in a hidden field.

@gunglien I'd rather not rely on the form fields incase it encounters a meddling user

$_session[] ...

@tristan you can use something like @vladG suggested. You can use Symphony cookies to store variables too - then you can access them from whatever custom event that you want.

$cookie = new Cookie('cookieName',TWO_WEEKS, __SYM_COOKIE_PATH__, null, true);
//to read
$variable= $cookie->get('variable');
//to write
$cookie->set('variable',$variable);

@vlad & @gunglien I totally overlooked using an approach like that. Will do some homework.

Thank you for advice.

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