Making use of the M2 Invitation Code stored in _usermeta

Hello Gurus!

I have had a long thread running in the community about fitting M2 to our unusual membership model, and I’ve gotten some good suggestions. But new information as of today indicates that we were all operating on misinformation, and making this harder than it has to be. So with some new facts under my belt, my question has evolved into a support question, so here I am.

I want to understand the capabilities of M2 in grouping users by the invitation code they used to join their membership.

Since we’ll be giving groups of users the same invitation code, we would like a way to manage those members en masse, or list them all together. Such as….

– list all who have the same invitation code

– expire all who have the same invitation code

– reinstate all who have the same invitation code

I see that are entries in the _usermeta table for invitations, based on the custom post ID of the invitation code they used. I’m not sure what happens if someone changes their invitation code (i.e., signs up for a different membership with a different code)….do they have two associations in _usermeta? or just the most recent one? Likewise, what if they are in two memberships (via the add-on), that each require a different invitation code?

Would love to get these questions answered, and see what we can do with this association.

Thanks!

  • Michael Bissett
    • Recruit

    Hey @mabraham1,

    I’m not sure what happens if someone changes their invitation code (i.e., signs up for a different membership with a different code)….do they have two associations in _usermeta?

    That he does, this is an example of what the value for the “invitation_code_used” entry in the _usermeta table looks like:

    a:2:{i:0;i:323;i:1;i:324;}

    323 & 324 are the IDs of the invitation codes used, as I signed up for different memberships.

    Hope this helps!

    Kind Regards,

    Michael

  • mabraham1
    • Site Builder, Child of Zeus

    Hi Michael,

    Thanks for that information. It answers my question about what happens if a user is in two memberships. But what about if a user changes his membership? Does the database keep the current/new one only? Is there any record of the old/original one?

  • Jude
    • DEV MAN

    Howdy @mabraham1

    Working alongside Michael Bissett on this one, hope you are keeping well !

    But what about if a user changes his membership? Does the database keep the current/new one only? Is there any record of the old/original one?

    I just did a few tests and can confirm this is the case. M2 keeps a track of all the invite codes used. Its stored with the meta key invitation_code_used and tied to specific users with their user_id.

    I still need to know if there is a way to access that information via M2, or if it’s a planned feature, or if I need to do customizations to make use of the info in the database?

    I think the best way is to use std WP techniques to access this data, a function like this will be the best way forward with your solution.

    https://developer.wordpress.org/reference/functions/get_user_meta/

    As for the development roadmap you can open a feature request and we’ll consider it based on the number of members who want something similar here

    https://premium.wpmudev.org/forums/forum/feature-suggestions

    Cheers

    Jude

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.