Ajax subscription returning the normal thank you page

Hi,
I’m using phpList version 3.3.2.

I finally managed to get my Ajax subscription page to work with Recaptcha. The response returned is the normal thank you text, not the Ajax text.

This the source of my Ajax page.
php.subscribe.html.txt.zip (1.6 KB)

Any ideas why this is happening?

Another problem: I do not get any error messages, if something goes wrong, e.g. if the subscription id is not found.
I have made this change index.php:
echo $result; //‘FAIL’;

Thanks!

I may have found the culprit for the first problem.
In the original code (index.php, around line 278) the string strEmailConfirmation contains the [email] place holder, which should be replaced the real email value.
I made the following changes and now I get the proper Ajax success message.

            //TESTif (stripos($result, $GLOBALS['strEmailConfirmation']) !== false ||
            //TEST    stripos($result, $pagedata['thankyoupage']) !== false
            $temp_text = str_ireplace('[email]',$_POST['email'],$GLOBALS['strEmailConfirmation']);
            if ((stripos($result, $temp_text) !== false ||
                stripos($result, $pagedata['thankyoupage']) !== false)
            ) {

The same should be done regarding the ‘thankyoupage’ as well.

Is anybody else using Ajax?

Now I get error messages. I found out that subscribelib2.php never returns the value of $msg.
I added return $msg; just before the function ListAvailableLists.

Then I concatenated $success into $result in index.php (around lilne 276):
$success = require ‘admin/subscribelib2.php’;
$result = ob_get_contents() . $success;

I had an outdated strEmailConfirmation string in my finnish.inc. The [email] place holder is removed from the english.inc.

The comment still says: “the EmailConfirmation message can contain placeholders”

The $pagedata[‘thankyoupage’] still contains the non-Ajax confirmation text. This does not matter, because the first part of the condition will be true.

It’s a bit confusing that strEmailConfirmation seems to origin from an inc file and $pagedata[‘thankyoupage’] from the admin side.