Please set a message!

4 replies · opened Aug 20, 2019

RrandalltxAug 20, 2019

Don't know what to do to correct "Please set a message!" error message and to get the footer subscription form to submit correctly.

See http://www.24hourdallas.org/index.html

Thank you for any help.

SSemicolon WebSTAFFAug 21, 2019

Hello,

We have checked out your Form and it appears to be an issue with the Message Setup in the include/subscribe.php File. Can you please provide us with an access to this File or post the codes here (without your private information) so that we can check the issue and provide you with pointers to fix it. Thanks for your Patience.

Meanwhile, do let us know if we can help you with anything else or if you find any further issues with Canvas.

RrandalltxAug 21, 2019

Here is include/subscribe.php Seems tied to MailChimp ... which I do not use. I could drop this into CampaignMonitor which I do use. Thank you.

<?php

$apiKey = ''; // Your MailChimp API Key
$listId = ''; // Your MailChimp List ID

if( isset( $_GET['list'] ) AND $_GET['list'] != '' ) {
$listId = $_GET['list'];
}

$email = $_POST['widget-subscribe-form-email'];
$fname = isset( $_POST['widget-subscribe-form-fname'] ) ? $_POST['widget-subscribe-form-fname'] : '';
$lname = isset( $_POST['widget-subscribe-form-lname'] ) ? $_POST['widget-subscribe-form-lname'] : '';
$datacenter = explode( '-', $apiKey );
$submit_url = "https://" . $datacenter[1] . ".api.mailchimp.com/3.0/lists/" . $listId . "/members/" ;

if( isset( $email ) AND $email != '' ) {

$merge_vars = array();
if( $fname != '' ) { $merge_vars['FNAME'] = $fname; }
if( $lname != '' ) { $merge_vars['LNAME'] = $lname; }

$data = array(
	'email_address' =&gt; $email,
	'status' =&gt; 'subscribed'
);

if( !empty( $merge_vars ) ) { $data['merge_fields'] = $merge_vars; }

$payload = json_encode($data);

$auth = base64_encode( 'user:' . $apiKey );

$header   = array();
$header[] = 'Content-type: application/json; charset=utf-8';
$header[] = 'Authorization: Basic ' . $auth;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $submit_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);

$result = curl_exec($ch);
curl_close($ch);
$data = json_decode($result);

if ( isset( $data-&gt;status ) AND $data-&gt;status == 'subscribed' ){
	echo '{ "alert": "success", "message": "You have been **successfully** subscribed to our email list." }';
} else {
	echo '{ "alert": "error", "message": "' . $data-&gt;title . '" }';
}

}

?>

RrandalltxAug 22, 2019

Nevermind.

I finally figured it out.

I needed to take the Campaign Monitor php, complete it, and upload it as subscribe.php

We are in business.

Thank you.

SSemicolon WebSTAFFAug 22, 2019

Hello,

Thanks for a more detailed explanation of your issue and Really Glad that your issues were resolved.

Instead of replacing the codes, it is more recommended to change the Form's action Attribute Value to include/subscribe-cm.php .

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard