Help using subscription forms across multiple websites

Tags: #<Tag:0x00007f7ed6f5a828>

I received the email below discussing the new options, but I don’t see any guide for how to implement them (the pull requests were not helpful). Is there a guide for how to use the subscription forms “across multiple websites.” Also, if I do this, I don’t understand how to use the ACCESS_CONTROL_ALLOW_ORIGINS.

Blockquote
New features
The AJAX-based subscription forms are now able to function across multiple websites. A new config constant called ACCESS_CONTROL_ALLOW_ORIGINS has been added which is an array where you can put in your different origins you want to allow. Also, a new header “Vary: Origin” has been added to optimize cache control in the case where the array option is used.- thanks to Nepomuk Leutschacher for the implementation. Have a look at the Pull Request. Additionally, now with the AJAX request, you can specify a particular list instead of all lists being used. Thanks to Duncan Cameron for the implementation. Have a look at the Pull Request.

.

@keeenone The change is only to do with providing a way to set different values for ACCESS_CONTROL_ALLOW_ORIGIN, instead of as previously only one host or ‘*’.

Take a look at the example in config_extended.php. You need to set either ACCESS_CONTROL_ALLOW_ORIGIN or ACCESS_CONTROL_ALLOW_ORIGINS but not both

Do you have a link where I can download the latest config_extended.php file? The auto-updater is not updating it. I found no references to anything with access control in my version.

@keeenone

Thank you.

Are there any sample forms available for how to set this up on a Web site?

@keeenone It’s not clear exactly what you mean, but see the section in the online manual for creating an ajax subscribe box
https://www.phplist.org/manual/books/phplist-manual/page/creating-a-subscribe-page

This is very helpful but I find this note towards the bottom very confusing:

NOTE 5: If test=0 in your phpList config.php file, then all subscribers remain unconfirmed as no confirm mail is sent.

If I set test=1 in my installation it says that NO emails will be sent. Why would I need to set it to 1 to use the AJAX subscribe box on my website? Isn’t this what it is saying?

Indeed, the subscription form worked, however, it does show that the user is unconfirmed, and I can confirm that the system did not send out a confirmation email. How can I use this AJAX subscribe box AND have a confirmation email sent out?

Also, in NOTE 5 mentioned above, I assume we are talking about this area of the config file, and setting this to 1 would mean that I am running a test installation, and not a live installation, right?

// if test is true (not 0) it will not actually send ANY messages,
// but display what it would have sent
define(‘TEST’, 0);

That is the wrong way around (TEST = 1 means that emails will not be sent out) but to me seems to be unnecessary advice.

So I have gotten the AJAX subscribe box script working on my site, however, it does not work for Safari browsers–which is now a huge number of Apple device users. Is there a version of this that works with Safari?

Correction, I had a small bug in my CSS that was breaking it in Safari, I got it working.

One recommendation would be for you to update the link in your example script here:
https://www.phplist.org/manual/books/phplist-manual/page/creating-a-subscribe-page

From this:
https://installationname.yourdomain.com/lists/?p=subscribe&id=1

To this:
https://installationname.yourdomain.com/lists/?p=asubscribe&id=1

I think it would avoid some headaches for people.

Sorry about all of the posts. Actually there does seem to be an issue with Safari on iPhones when using this form. I can get this working on the desktop with no issues, but have only got it to work sporadically on Safari. Any ideas?

Can you run this script twice on the same page? This may be causing me some issues…