I don't know exactly how that works, seems to be a forum cms, so that should be implemented using their guidance for which you'll have to ask on their support.Will I be able to use this type of list with what you built? https://www.pathlabtalk.com/forum/index.php?/newsletter.html/
Perhaps not a top priority to make this a feature within the app to allow the user to select which lists to display at the forms@Dilbert - I have attached an example form that would use ajax to subscribe to 5 different lists at once.
Unzip and upload the folder on your server, then open index.php and look for:
And replace with your own info.PHP:$config = new MailWizzApi_Config(array( 'apiUrl' => 'http://www.mailwizz-powered-website.tld/api', 'publicKey' => 'PUBLIC-KEY', 'privateKey' => 'PRIVATE-KEY', ));
And also find:
And replace the list uids from here with your own list uids.Code:<option value="cr105po1w3d1d"> List 1 </option> <option value="cr105po1w3d2d"> List 2 </option> <option value="cr105po1w3d3d"> List 3 </option> <option value="cr105po1w3d4d"> List 4 </option> <option value="cr105po1w3d5d"> List 5 </option>
Then you can try it and you'll see how you get subscribed to all the lists you select.
<script>
jQuery(document).ready(function($){
// bootstrap button
$('.btn-submit').button();
$('#content form').on('submit', function(e){
e.preventDefault();
var $this = $(this);
var $message = $('.message');
var $email = $('input[name=EMAIL]', this);
// empty any previous message
$message.empty().removeClass('error').removeClass('success').hide();
// remove dynamically attached error elements
$('.error', $this).remove();
// just a small check, the api server will check anyway
var email = $email.val();
if (!email || email.indexOf('@') < 0) {
$message.addClass('error').text('Please enter a valid email!').show();
return false;
}
// show the loading text on the submit button
$('.btn-submit').button('loading');
// post the form to the php script and get the response
$.post('', $this.serialize(), function(json){
$('.btn-submit').button('reset');
$message.text(json.message).show();
// if the status is success, add the success class.
if (json.status == 'success') {
$message.addClass('success');
// also, empty the fields
$('input[type=text]', $this).val('');
} else {
// otherwise, add the error class.
$message.addClass('error');
}
}, 'json');
return false;
});
});
</script>
<script>
jQuery(document).ready(function($){
// bootstrap button
$('.btn-submit').button();
$('#content form').on('submit', function(e){
e.preventDefault();
var $this = $(this);
var $message = $('.message');
var $email = $('input[name=EMAIL]', this);
// empty any previous message
$message.empty().removeClass('error').removeClass('success').hide();
// remove dynamically attached error elements
$('.error', $this).remove();
// just a small check, the api server will check anyway
var email = $email.val();
if (!email || email.indexOf('@') < 0) {
$message.addClass('error').text('Please enter a valid email!').show();
return false;
}
// new check, make sure at least one list is checked:
if ( ! $('input[name="lists[]"]:checked').length ) {
$message.addClass('error').text('Please select at least one list!').show();
return false;
}
// show the loading text on the submit button
$('.btn-submit').button('loading');
// post the form to the php script and get the response
$.post('', $this.serialize(), function(json){
$('.btn-submit').button('reset');
$message.text(json.message).show();
// if the status is success, add the success class.
if (json.status == 'success') {
$message.addClass('success');
// also, empty the fields
$('input[type=text]', $this).val('');
} else {
// otherwise, add the error class.
$message.addClass('error');
}
}, 'json');
return false;
});
});
</script>
Thank you very much for the updated script!p.s: the page assets that you load now from mailwizz.com, better download them locally and load them from your site
PHP: $config = new MailWizzApi_Config(array(
'apiUrl' => 'http://www.mailwizz-powered-website.tld/api',
'publicKey' => 'PUBLIC-KEY',
'privateKey' => 'PRIVATE-KEY',
));
ok, I generated the keys, but I do not see the URL. Where is it?@laurentiu - It is Customer Area > API from where you generate the keys and you see the URL to the api.
Use UNSUBSCRIBE_FROM_CUSTOMER_URL instead of UNSUBSCRIBE_URLIs there a link I could add to the bottom of the newsletter to unsubscribe to all?
Uh oh, new problem?Use UNSUBSCRIBE_FROM_CUSTOMER_URL instead of UNSUBSCRIBE_URL
You can use [UNSUBSCRIBE_FROM_CUSTOMER_LINK] is the same as [UNSUBSCRIBE_LINK] but this will unsubscribe subscribers from all the customer lists.Uh oh, new problem?
I am using [UNSUBSCRIBE_LINK], is it supposed to be UNSUBSCRIBE_URL?
Do I need the [ ] brackets?