back to phpList.org

[SOLVED] Ajax subscribe api


#21

Thanks @duncanc, that helped me solve my dilemma!

It turned out that it was actually working correctly, but since I don’t have a mail server configured on my localhost, phplist was responding: Sorry, sending the message to request your confirmation failed, please click "Reload" to try again. If it still does not work, please contact the administrator.

When I uploaded the code to my server it worked as expected.

So, for anyone else having trouble with this:
You need a working mail server in your development environment to test this.
(Which I should have remembered from reading the phplist development guide…)


#22

I have a new problem. I’m now trying to pass additional parameters by they aren’t being recorded.
I enabled the parameter in the subscribirían page in config and its being passed back in the url (I see it in console log)

Any idea why this could be happening?


#23

If a wrong subscription page id is given, phpList will use the default subscription page, which probably is not good for Ajax.
This my change in index.php around line 120:
// make sure the subscribe page still exists
$id_save = $id;
$req = Sql_fetch_row_query(sprintf(‘select id from %s where id = %d’, $tables[‘subscribepage’], $id));
$id = $req[0];
if ($id == null) {
echo sprintf($GLOBALS[‘strSubscriPageMissing’],$id_save);
return;
}

english.inc:
$strSubscriPageMissing = ‘Subscription page (%s) missing’;


#24

Limit this to asubscribe only:

if ($id == null && (isset($_GET[‘p’]) && $_GET[‘p’] == ‘asubscribe’)) {


#25

Belatedly many thanks for this @veltsu. Now a Mantis issue here: https://mantis.phplist.org/view.php?id=19525