I found a cron, then i just tried to execute for expire account. My membsership role is PMembers and lelel is (standard, gold, premium) different for different users based on payment. When i execute cron for exipry, it changed the correspondent account role to subscriber and level is empty. If user again tried with login details, its redirecting to wp-admin dashbaord. Is it anyway to change status active to inactive when execute cron, or using any plugin to manage account expiry. When execute pmpro_cron_expiration_warnings, not getting any mail to the account that will expire with in one day.
Can you please respond for my doubt. In my case after ‘
pmpro_cron_expire_memberships’ cron execute, corresponding members user role changed to ‘subscriber’ and its able to allow login and redirecting to wp-admin. then if they try to access front-end that also possible. Anyway to change user status to inactive when running cron.
Hi @neethuanna03rocket
Thank you for using Paid Memberships Pro.
It sounds like you are setting up a custom role based on level, this isn’t default functionality of Paid Memberships Pro; By default we don’t adjust the user roles when signing up for a membership.
Once the user expires/cancels, you are able to use custom code to change their role to a custom role and deny dashboard access using a plugin that can manage WordPress capabilities.
You should be able to hook into the pmpro_after_change_membership_level hook – https://www.paidmembershipspro.com/hook/pmpro_after_change_membership_level/
You can check to see if the user’s level_id is 0 (0 is used for cancellation/expired) and then restrict access/change role accordingly.
I hope this helps get you started.