Subscription "renewal" causing loss of WordPress "Role"

We recently noticed that sporadically we were having users lose access to our forums (bbpress). After some digging it looks like it has to do with the renewal of the indefinite subscriptions. Users are losing their role of "bbp_participant" (which all user are assigned by default when they register) when their subscription automatically renews. This seemed a little strange to us. But it could be due to our custom implementation.

Note: We are NOT utilizing the default subscription forms that come with the plugin. We are using gravity forms and tying into their actions and assigning subscriptions based on that instead of making it a selectable option.

I can easily double check this outside of Membership w/ an action. Are there any actions I can hook into when the renewal fires just so I can be sure that if the user has a subscription.

  • aware
    • Design Lord, Child of Thor

    Not a problem. Thanks for the help

    I was doing some brainstorming and was thinking of a few solutions

    Our memberships won't ever expire once a user is registered (unless set innactive by an admin). So maybe a quick fix could be to apply a new subscription/level expiration date (year) in the database to something like 2099 so it wont expire anytime soon? Just need to crawl through 5k or so registered users in the db.

    The other option would be to add in a hook so we can tie into the renewals as I mentioned before. If the user has a role of None we can automatically update the users meta to have bbp_participant instead.

  • aware
    • Design Lord, Child of Thor

    Thanks everyone,

    Does that functionality have to be enabled some where? I don't see that option at all in the admin. I do remember us having that enabled initially but we disabled it before the latest version of membership came out. I think due to us utilizing an unorthodox method for applying users the auto-assigning a role was giving a conflict.

    I actually ended up just updating the database so the renewals were 20 years in the future.

    So I guess we can say "resolved"

  • Erik
    • Site Builder, Child of Zeus

    If you are using your own gravity form registration/subscription and just tying into the hooks, why not simply run " update_user_option( $user_id, 'role', 'bbp_participant' ); " after your existing update functions?

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.