File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ function mailchimpinfo()
1919
2020 function save ()
2121 {
22-
2322 $ batch_save_data =array (
2423 'company ' =>$ this ->input ->post ('company ' ),
2524 'address ' =>$ this ->input ->post ('address ' ),
@@ -36,6 +35,16 @@ function save()
3635 'timezone ' =>$ this ->input ->post ('timezone ' ),
3736 'print_after_sale ' =>$ this ->input ->post ('print_after_sale ' )
3837 );
38+
39+ if ($ key = $ this ->input ->post ('mc_api_key ' )) {
40+ $ this ->load ->library ('MailChimp ' , array ('api_key ' =>$ key ), 'MailChimp ' );
41+ $ success = ($ this ->MailChimp ->ping () === "Everything's Chimpy! " );
42+ $ mc_message = $ success ? 'Connected to MailChimp! '
43+ : "Unable to connect to MailChimp. Please check your connection and your API key. " ;
44+ $ validated_api_key = $ success ? $ this ->input ->post ('mc_api_key ' ) : '' ;
45+
46+ $ batch_save_data ['mc_api_key ' ] = $ validated_api_key ;
47+ }
3948
4049 if ($ _SERVER ['HTTP_HOST ' ] !='demo.phppointofsale.com ' && $ this ->Appconfig ->batch_save ($ batch_save_data ))
4150 {
You can’t perform that action at this time.
0 commit comments