Search

Sorry, didn't have time this weekend. Thursday looks good though.

Used this extension for the first time today - dropped right in and works great. Thanks Lewis.

Hi Lewis

Just spotted the update on symphonyextenions site. Works a treat!! Thanks!

@davecoggins still having trouble on that ? Sorry, I missed @Lewis's tweet... Can you provide a online example of your problem ??

BTW, redirection is not supported on the server side, but could easily be implemented in javascript...

@nitriques, problem was solved with @Lewis last update to the extension so everything is fine now. I just needed the form to redirect on successful submission which it now does.

@davecoggins Great! Sorry about my late reply...

@davecoggins, are you using the AJAX approach still? What about http://getsymphony.com/discuss/thread/32883/3/#position-53

@lewis, I had forgotten about that. In the end I decided to go with the redirect instead. The client wanted an easy way to track newsletter sign ups using google analytics and that seem the easiest solution.

Is it possible to to use event chaining with the mailchimp extension? I have a website where users enter their name and email address to request a download link. That event is working fine and uses the email template manager to send emails to user and admin. But i also have a check box to allow them to subscribe to newsletter.

Is it possible to trigger the mailchimp event from my first event? I have done a custom event before so kind of got an idea of what i'm doing but was unsure with all the merge field stuff and cookies with the mailchimp event.

Anyone got any advice?

Thanks in Advance

You can mess with Event priorities to get this done :)

You would set your first Event to be 'High' and then your dedicated Mailchimp event to be 'Low'. Chain the two events together as you have done previously :)

You can mess with Event priorities to get this done :)

That's exactly what I do and include something like below in that first event's __trigger(), where chimp-link is the name of my subscribe checkbox...

if($result->getAttribute('result') == "success" && $_POST['chimp-link'] == 'yes') {

    $_POST['action']['signup'] = 'Submit';
    $_POST['email'] = $_POST['fields']['email'];
    $_POST['merge']['FNAME'] = $_POST['fields']['firstname'];

}

Thanks @brendo and @lewis, that works a charm!!

Here is my final trigger function for reference if anyone else needs in the future:

public function priority(){
    return self::kHIGH;
}

protected function __trigger(){



    include(TOOLKIT . '/events/event.section.php');


    if($result->getAttribute('result') == "success" && $_POST['fields']['subscribe-to-newsletter'] == 'yes') {

        $_POST['action']['signup'] = 'Submit';
        $_POST['email'] = $_POST['fields']['email'];
        $_POST['merge']['FNAME'] = $_POST['fields']['name'];
        $_REQUEST['redirect'] = '/thank-you/';

    }

    return $result;


}

One thing I did have to change though was line 400 in event.section.php from:

$result = new XMLElement(self::ROOTELEMENT);

to

$result = new XMLElement($this->ROOTELEMENT);

Is this a bug or am I doing something wrong?

I also tried to do the new unique naming of event fields as per your tutorial @brendo but I must have been doing something wrong because it kept on throwing errors.

Thanks again guys!

Is this a bug or am I doing something wrong?

Make sure you declare $ROOTELEMENT in your event as a class property.

public $ROOTELEMENT = 'event-name-here';

Hi Lewis, I checked the event and $ROOTELEMENT is defined as you say. The error I get when line 400 of event.section.php is set to:

$result = new XMLElement(self::ROOTELEMENT);

is:

Fatal error: Undefined class constant 'ROOTELEMENT'

I'm running Symphony 2.3.2

If you define $ROOTELEMENT then ou access it by $this->ROOTELEMENT or self::$ROOTELEMENT. Notice the $ in the last example.

So we have a bug in event.section.php?

Yeah, that would be true.

@designermonkey, will you care for this, please?

I don't think it is a bug. If ROOTELEMENT was a constant (which is the convention for events), using self::ROOTELEMENT should be fine. So maybe @Lewis was wrong. You should declare:

const ROOTELEMENT = 'foo';

@davecoggins: Please try that, it should work.

Changing to:

const ROOTELEMENT = 'foo';

fixes the bug but then I suppose my next question would be why does Symphony generate the event php file with the line as:

public $ROOTELEMENT = 'foo';

After reading @brendo response here I interpreted it as:

public $ROOTELEMENT = 'foo';

Is the preferred way and that it should be accessed as:

$result = new XMLElement($this->ROOTELEMENT);

I'm no php expert so I'm out of my depth to know which is the correct method but it would seem that one of those 2 lines should be changed to prevent the error from occurring.

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