Search

I presume something like that should work never did it though. If it doesn't work I can dig through some code I have on how to obtain the current member Id in php.

Using this for the Recipients field worked:

{/data/kundendaten/entry[@id=/data/events/bestellmail/post-values/b-kunde]/vorname-kind} {/data/kundendaten/entry[@id=/data/events/bestellmail/post-values/b-kunde]/nachname-kind} <{/data/kundendaten/entry[@id=/data/events/bestellmail/post-values/b-kunde]/e-mail}>

Any chance to save the new entry including the Member ID with your event (that triggers the email)? In this case you could get the new entry by filtering with {$etm-entry-id} and ouput the member-id as a parameter (to filter your Members data source).

Ah, I see you solved it differently.

Thanks Michael,

I might still need to do it the way you mentioned it seems. Problem is I have yet another DS of orders that needs to be filtered by $member-id, so it wont display all orders by other members.

I wonder why the $member-id is absent for the event in the first place? Is the event somehow detached from the page itself?

@Jonathan the more I think about it, the cleanest solution for me really would be to have the $member-id somehow present during event execution, since it is used to filter the member- and the order-data which is processed for the notification mail.

Would you mind digging that out for me? :)

Like in this post?

$_POST['fields']['associated-member'] = Symphony::Engine()->Page()->_param['member-id']

n’ah … I’m lost :(

Guess I’ll move forward embedding all the data I need in the entry my event creates and fetch it from there instead.

This should do the trick, I've had it in one of my events to process some cart related stuff (where I don't want to pass the member id. I'm not entirely sure how you'd pass it through to ETM. Can't seem to find that part...

        $members = Symphony::ExtensionManager()->create('members');
        $member_id = $members->getMemberDriver()->getMemberID();

Thanks Jonathan,

could I make use of /data/events/member-login-info/@id in the event instead? Would that be available?

@animaux, to see what is available to the ETM, you can append ?debug=params to the template preview URL. The ETM builds its own (reduced) set of params. So /data/events/member-login-info/@id won't work, for example. You might be able to inject more parameters in the event, but I am not sure. Anyway these will be hard to debug. In suggest using an email template with a simple copy of the parameters and send test emails to see the parameter values.

P.S.: I always used saved entry data. Chaining datasources is possible, so you can do cool things.

Many many thanks Michael!

I've checked what I did.. for the ETM what I actually did was create a fake EventFinalSaveFilter event with custom entry parameters... as ETM uses the $entry->get('id') you can use that as $etm-id but I guess not the cleanest solution...

Thanks Jonathan!

I wonder how I could retrieve the current member-id in the ETMs class.emailtemplate.php in order to add in the ETMs ParamPool. Using Jonathan’s code in there throws an error:

Fatal error: Call to a member function getMemberID() on a non-object in /…/extensions/email_template_manager/lib/class.emailtemplate.php on line 24

The fact that I can use ?debug=params on the preview page is really lovely, thanks again Michael :)

Thanks again for your patience guys. I solved this with an approach similar to what Michael suggested.

A way to find an author/member ID in Symphony is something like:

if (Symphony::Engine() instanceof Administration) {
    if (is_callable(array('Symphony', 'Author'))) {
        $author = Symphony::Author();
    } else {
        $author = Administration::instance()->Author;
    }
    $author_id = $author->get('id');
} elseif (Symphony::Engine() instanceof Frontend && (Symphony::ExtensionManager()->fetchStatus('members') == EXTENSION_ENABLED)) {
    $Members = Symphony::ExtensionManager()->create('members');
    $author_id = $Members->getMemberDriver()->getMemberID();
}

(This is basically @gunglien's code, just more "universal".)

I am not sure if this will work, however, nor would I recommend to "hack" the ETM extension. You may either try this or you may try to save the Member ID with the entry, then use chained datasources.

This is the way I do it, most of the time:

  • If a Member saves an entry, the Member ID is saved with the entry (requires the section to have an SBL for Members, of course)
  • For the ETM, I create two datasources:
    • an entry DS (filtered by {$etm-entry-id}, with the Member SBL value as output parameter
    • a Member DS, filtered by the param output of the first datasource

That way I have all the data I need to create a "personalized" E-Mail.

@Micheal agree that's the correct way to do it if your'e using vanilla Symphony Events.

I had to customise as I was storing payment/order data and needed to send a confirmation email. It's much easier to simulate an Event compared to manually trying to send an ETM email.

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