We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9486
    • 39 Posts
    Hi, I have added the files to my site in my assets folder and edited the API key how do I call it on a page? Should I use formit and link it with that?

    Thanks for your time!
      • 14951
      • 151 Posts
      Quote from: ecreate at Dec 01, 2010, 05:47 PM

      That’s it. I’m going to work on an lightweight AJAX version using Jquery shortly.

      Has there been any further progress on this?

      and +1 for adding to the repo!
        • 30498
        • 30 Posts
        Great snippet garry, works perfectly for me in evo 1.0.5

        Here’s a tip. Calling it from webloginPE case register using the modx runSnippet method from within the (slightly modified) webloginPE snippet works just peachy as wel.
        Saved me a load of work when integrating a newsletter signup tickbox into an existing register form.

          • 35551
          • 1 Posts
          @garryn

          I cant get it working in Evo 1.0.5
          I Get Those errors

          MODx encountered the following error while attempting to parse the requested resource:
          « Execution of a query to the database failed - Incorrect string value: ’\xA0’ for column ’moduleguid’ at row 1 »
          SQL: INSERT INTO `newsletter`.`modx_site_snippets` (name, description, snippet, moduleguid, locked, properties, category) VALUES(’mailchimpSubscribe’, ’’, ’\r\ngetChunk($form) != null) {\r\n if (isset($_POST[\’subscribe\’])) {\r\n require_once MODX_BASE_PATH.\’assets/snippets/mailchimp/classes/MCAPI.class.php\’;\r\n require_once MODX_BASE_PATH.\’assets/snippets/mailchimp/includes/config.inc.php\’;\r\n \r\n // Connect to the MailChimp server with the user\’s credentials.\r\n $api = new MCAPI($username, $password);\r\n if ($api->errorCode!=\’\’) {\r\n if ($debug == true) {\r\n $debugOutput .= \"code:\".$api->errorCode.\"\\n\";\r\n $debugOutput .= \"msg :\".$api->errorMessage.\"\\n\";\r\n return $modx->getChunk($form);\r\n } else {\r\n $modx->setPlaceholder(\’MailChimp.message\’, \’Login to remote service failed\’);\r\n return $modx->parseChunk($form, $modx->placeholders, \’[+\’,\’+]\’);\r\n }\r\n }\r\n \r\n $mergeVars = array();\r\n foreach($_POST as $key => $value) {\r\n if(substr($key,0,3) == \’mc_\’) {\r\n $fieldName = ltrim($key, \’mc_\’);\r\n $mergeVars[$fieldName] = $value;\r\n }\r\n }\r\n \r\n if(empty($mergeVars)) {\r\n $mergeVars = array(\’\’);\r\n }\r\n \r\n $retVal = $api->listSubscribe($listId, $_POST[\’mc_EMAIL\’], $mergeVars);\r\n \r\n if (!$retVal) {\r\n if ($debug == true) {\r\n $debugOutput .= \"Unable to load listSubscribe()!\\n\";\r\n $debugOutput .= \"\\tCode=\".$api->errorCode.\"\\n\";\r\n $debugOutput .= \"\\tMsg=\".$api->errorMessage.\"\\n\";\r\n }\r\n $modx->setPlaceholder(\’MailChimp.message\’, \’There was a problem subscribing you.\’);\r\n } else {\r\n if ($debug == true) {\r\n $debugOutput .= \"Returned: \".$retVal.\"\\n\";\r\n }\r\n $modx->setPlaceholder(\’MailChimp.message\’, \’You were successfully subscribed\’);\r\n }\r\n }\r\n if ($debug == true) echo $debugOutput;\r\n if (is_array($modx->placeholders)) {\r\n $ph = array_merge($modx->config, $modx->placeholders);\r\n } else {\r\n $ph = $modx->config;\r\n }\r\n return $modx->parseChunk($form, $ph, \’[+\’,\’+]\’);\r\n} else {\r\n return \’Please specify a valid form.\’;\r\n}\r\n?>\r\n’, ’ ’, ’0’,’’, ’0’);
          [Copy SQL to ClipBoard]

          Parser timing
          MySQL: 0.0020 s (1 Requests)
          PHP: 1306836988.9091 s
          Total: 1306836988.9111 s
            • 36613
            • 328 Posts
            the file mailchimp_2.zip don't permit dowload.
              • 2901
              • 277 Posts
              Hi Guys

              I've tried the snippet with evo 1.0.5 but I get a parse error. I did the setup as mentioned on marys codinpad. this is the error message. However the file is right at this place.

               Error:	require_once(/Users/beatbeer/Sites/tvg/assets/snippets/mailchimp/classes/MCAPI.class.php) [function.require-once]: failed to open stream: No such file or directory	 
                Error type/ Nr.:	Warning - 2	 
                File:	/Users/beatbeer/Sites/tvg/manager/includes/document.parser.class.inc.php(814) : eval()'d code	 
                Line:	16


              your help is much appreciated [ed. note: bbeer last edited this post 12 years, 2 months ago.]
                • 9995
                • 1,613 Posts
                I tried it this way in Evo 1.6:

                This post as base: http://forums.modx.com/thread/18409/mailchimp-and-modx?page=5#dis-post-101076

                Downloaded the package.
                Uploaded it into the snippets map.
                Changed a line (20 +/-) into subscribe.snippet.php (api instead of password, username)
                Updated the MCAPI.class.php downloaded from mailchimp (1.3)
                Changed the config file to the api, see post
                Added the form mcSubscribeForm:

                <p>[[+MailChimp.message]]</p>
                <form method="post" action="[~[*id*]~]">
                    <label>First Name: <input type="text" name="mc_FNAME" value="" /></label>
                    <label>Last Name: <input type="text" name="mc_LNAME" value="" /></label>
                    <label>Email: <input type="text" name="mc_EMAIL" value="" /></label>
                    <input type="submit" name="subscribe" value="Subscribe" />
                </form>


                The call:
                [ ! mailchimpSubscribe?form=`mcSubscribeForm` &listId=`xxxx32edb` ! ]


                I see the form but after submitting, nothing happens sad

                Anyone got this working lately?



                #EDIT#

                When I paste the embedded code from mailchimp it opens into a new page, got email, and need to accept, but its not on my website..
                Maybe someone can figer it out what to do, I'm done with it at the moment pfff.


                
                < link href="http://cdn-images.mailchimp.com/embedcode/slim-081711.css" rel="stylesheet" type="text/css">
                < style type="text/css">#mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }</style>
                
                < div id="mc_embed_signup">
                < form action="http://websiteurlhere.us6.list-manage1.com/subscribe/post?u=320fd49a9019b27cexxxxx8b3&id=xxxx32edb" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
                	<label for="mce-EMAIL">Subscribe to our mailing list</label>
                	< input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
                	<div class="clear">< input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
                < /form>
                </div>


                [ed. note: fourroses666 last edited this post 11 years, 5 months ago.]
                  Evolution user, I like the back-end speed and simplicity smiley