@dcorbin42
There is no clean way to do this and it has a high potential to break the login process for existing members who checkout and even regular users who are trying to log in.
If you don’t mind, can you please explain why you would like to avoid users being auto-logged-in after checkout? That will help us determine a solution for you.
Thank you,
Ronald Huereca
Absolutely.
Our scenario is that we have 3 membership plans: Individual, Institutional (5 seats), Institutional Unlimited (we set to 500 seats)
Our client is a professional group for college administrators, and as such, the colleges typically purchase the memberships on behalf of the members. At some institutions, the payment cardholder is NOT a member of the organization and we do not want them to have an account on the site. Department secretaries are often the ones who have the credit cards.
We have figured out how to prompt the cardholder at checkout to enter the primary member’s email address and that will create the account under the primary member’s email, auto generate the username and password and then email the primary user with a password reset link to let them know they have an account and to login. However, the cardholder gets auto-logged in to the newly created account after successful payment and that account is not always
account. We would like them to instead get redirected to a page with further instructions.
We recognize renewals is going to be an issue with this setup because the primary account will already exist in a year when the payments need to be made again. If the cardholder goes to renew, they will find the account already exists. This could be a non-issue for us since we may be wiping the memberships every year anyway as a matter of course.
What we would ideally like is a way for a non-member to purchase seats – just pay and get an email with the discount code to forward to the primary contact so they can make their account and give the code to any other members to make their respective accounts, but that is not possible right now from what I can tell from the documentation and looking around on these forums. This other method described above is the closest we have devised to met the client’s requirements.
I don’t think it will be a problem for the sponsored members to have the same thing happen to them when they register because they will receive the email themselves and then they can login following the password reset link just like the primary member does. We just don’t want anyone to get auto-logged in after registration.
Thank you for anything you can think of to tackle this.
@dcorbin42
Thank you for that very detailed explanation. It does sound like you’re already using a few of our add-ons, but I am only allowed to provide support due to .org guidelines on the core Paid Memberships Pro plugin.
The Gift Add-on might be better for your use-case, but there isn’t a way for the gift giver or sponsorer to not have an account.
Logging them out after checkout is always possible, but it would have to be written very carefully not to affect existing logged-in-users.
There is the pmpro_after_checkout_preheader hook where you can remove the logged-in user’s authentication cookie, but you would have to run some custom logic to determine the user’s level (sponsor or gift level) so that the other users can create an account with their discount codes.
I apologize. There is no clean solution for this using PMPro. The auto-log-out isn’t recommended based on the many moving parts and the probability of side-effects is high.
Regards,
Ronald Huereca