memberpress and mailpoet 3 welcome email not sent - temp how to fix

User avatar
axew3
w3all User
w3all User
Posts: 1971
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

memberpress and mailpoet 3 welcome email not sent - temp how to fix

Post by axew3 »

as on my tests last night, after someone passed me the answer from mailpoet:
Good news and bad news! The good news is I believe I've found the root cause. The bad news is. Another user has the same issue (MemberPress as well) and it looks like it has to be fixed in their integration.

It looks like it's an issue with their integration, they are missing the send_confirmation_email and send_welcome_email parts from https://kb.mailpoet.com/article/195-add ... Subscriber

While that shouldn't be needed as they default to true, it appears because MemberPress modifies the signup flow that they actually return false, so it looks like this needs to be fixed on MemberPress's side.
this can be true, may the process on memberpress do non fire correctly the WP user_register filter/hook, i've still not test this part of the memberpress mailpoet addon, so may also the above is completely correct from mailpoet and it would be a bug in memberpress about this.

But i was aiming to welcome email not working, that not require to add users to mailpoet lists, but only to pass the correct WP user ID to the mailpoet synchronizeUser method, and it is done correctly on memberpress where:

Code: Select all

\MailPoet\Segments\WP::synchronizeUser($usr->ID);
what in the other side happen when this is executed, is that on file
/wp-content/plugins/mailpoet/lib/Segments/WP.php
where code:

Code: Select all

        break;
      case 'profile_update':
      case 'user_register':
        $schedule_welcome_newsletter = true;
      case 'added_existing_user':
      default:
the case not fire, because the user_register action/filter already executed.
To resolve, change the above with this:

Code: Select all

        break;
      case 'profile_update':
      case 'user_register':
      case 'mepr-signup':
        $schedule_welcome_newsletter = true;
      case 'added_existing_user':
      default:
may mailpoet is totally right about the fact in memberpress something execute earlier and in a not common way that lead mailpoet to not fire/recognize the user_register action: but i need a fast fix and this work in just a line.

p.s in case same page process some payment or user data confirmation, may the code could be these 3 lines instead, to avoid to re-send out welcome emails to users, in case (for example), of payment renew processed within same registration page:

Code: Select all

   break;
      case 'profile_update':
      case 'user_register':
      case 'mepr-signup':
     $schedule_welcome_newsletter = true;
     if( current_filter() == 'mepr-signup' && isset($_REQUEST['logged_in_purchase']) OR current_filter() == 'mepr-signup' && isset($_REQUEST['mepr_process_payment_form']) ){
     	$schedule_welcome_newsletter = false;
     }
      case 'added_existing_user':
      default:

Poonaam
Posts: 1
Joined: Fri Jan 24, 2020 7:21 am
Contact:

Re: memberpress and mailpoet 3 welcome email not sent - temp how to fix

Post by Poonaam »

Hi!
Excellent ! I got useful information here. Thank you!

tocnaza
Posts: 1
Joined: Tue Feb 04, 2020 8:33 am

Re: memberpress and mailpoet 3 welcome email not sent - temp how to fix

Post by tocnaza »

Thanks for the info!
La sonrisa que esconde el Joker

User avatar
axew3
w3all User
w3all User
Posts: 1971
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: memberpress and mailpoet 3 welcome email not sent - temp how to fix

Post by axew3 »

I'm just over for a site, where they need to allow forum access, only after payment executed (then membership subscription active).
The easy mod, and the way it do the dirty easy work:
a funtion into wp_w3all retrieve memberpress active transactions, using native memeberpress method, that not overload nothing.
Inside the same, check phpBB user session, where group id which by default user belong to result already into available data. So again cost 0.
If there are not MP active subscriptions, update the user's group to one that have no ability to view forums (if required), if not, add/switch/update to normal registered group when the case. Easy as is.
The code just need to implement options into plugin admin about this, so the joke can be available for anyone with easy.
I will consider to add these kind of addons.

Post Reply