[Membership 2 Pro] Membership ID Numbers Incorrect

Hello,

We have had members on our old website for quite some time and have recently built a new website and used Membership 2 Pro to manage the members.

There is an issue though, as our members have long standing ID numbers (they are on their membership cards etc).

It seems we are unable to edit the member numbers as they are WordPress ID numbers? I'm wondering if there is a workaround here so we can display the CORRECT membership numbers?

Any help/advice would be greatly appreciated.

  • Adam Czajczyk
    • Support Gorilla

    Hi Simon

    I hope you're well today and thank you for your question!

    You're right, the ID is a standard WP user account ID. There's no "member number/ID" feature built-in and that ID in plugin is used mostly for "technical reasons" - to identify user account on code level, where necessary.

    Since these IDs changed, I believe these user accounts were exported/imported to the new site either via the native WP export/import tool and/or Membership export/import or some other plugin. This happens because when the ID field in the database is auto-incremented (so whenever you add a new record directly in the db to that table, the ID field is automatically set by db engine). That's pretty standard procedure.

    Whether there's a solution for this or not, that depends, mostly on the "complexity level" of the site.

    For example: do those users add any content to the site (posts, attachments, even comments)? Are there any additional ways account ID is utilized - e.g. to "assign" some content to the given user on site and/or extend user profile via some additional plugin?

    Or are these users only able to login and view the content but do not add anything (except from editing their profiles of course) on site at all?

    The latter would be perfect as it would give a chance to "restore" those original IDs if you still got an access to the original database. Most likely it would be enough to

    - remove the wp_users and wp_usermeta tables from the new site's database
    - export the wp_users and wp_usermeta tables from the originaldatabase directly (e.g. via phpMyAdmin) and import them to the new site's database

    That would maintain IDs. On the other hand: if there were any users added to the new site meanwhile that would delete them too so you might need instead to "merge" the tables - remove only affected users from the new site and export/import them from original to existing tables on on new site. Still though - on the database level only.

    However, this would work perfectly on a "vanilla install" but on an existing, production site there's quite a lot of unknown variables involved that might actually affect the process.

    Another option could be to create a custom script that would export/import users including their account IDs but that still is with that assumption that there's no content/data of any kind (other than user account related data) associated with these users.

    Whichever of this options you'd be about to try, I would strongly recommend doing that on some dev/staging site rather than a production site to make 100% sure that works for you.

    To avoid similar cases in future, i think the best solution would be to simply create an additional (non editable by user) user profile field for storing "member id" and just create and assign (either manually or via a custom code) an additional user ID there. If it was a profile field - so a "user meta" data - it would be carried over with regular export/import, regardless whether the user account ID would be changed in the db or not.

    Best regards,
    Adam

  • Simon
    • Flash Drive

    Hi Adam,

    Apologies for the delayed reply, I have been out of the office. Thanks for the thorough message, it has certainly cleared things up.

    To confirm, the user's do not 'contribute' any content. Basically when they sign up they fill in a form which creates a profile for them, but other than that they do not need to contribute content at all.

    The only issue I see with the above, is they are not all sequential ID numbers. This is because we used to use another membership platform and have since moved over to WordPress+Membership2Pro. So the numbers our members have been assigned are from the OLD database.

    So I guess my question comes down to this: Is it possible to control the ID numbers? Going forward they will be sequential but for now we need to edit their membership ID numbers to match their ID cards.

  • Adam Czajczyk
    • Support Gorilla

    Hi Simon

    I admit I'm a bit confused now so let's make sure that we're on the same side, please.

    This is because we used to use another membership platform and have since moved over to WordPress+Membership2Pro. So the numbers our members have been assigned are from the OLD database.

    The IDs that you need to update, they are from the old site that was using a different "membership" plugin. It wasn't Membership 2 Pro, right?

    I assumed initially that it was export/import between two sites, both using Membership 2 Pro, where the user IDs (native WP account IDs which are used in M2P as user/member IDs) got "auto-incremented" upon import. There is a chance that having an old (original) database - with an assumption that members did not contribute to any content on site - could possibly help restore original IDs in such case.

    But it might not be that easy in this case because any restored user, if I correctly understand, would still carry on wrong IDs.

    Manipulating user IDs directly is not that simple. In a perfect case with just a basic WP install it would take editing _users and _usermeta tables manually (or with some custom script) but here it's more than this. There's quite a lot of additional data stored in _posts, _postmeta and _options tables that are all "interconnected" via the user account ID. Furthermore, some of that data is in format of serialized arrays which makes it even more complicated. Updating and maintaining all these relationships - that'd would be complex and I'm not even sure if that's actually doable without some serious custom code.

    Taking all that into account, there's yet another question: apart from being printed out on Members' membership cards, are those IDs used by Members for any other "online" actions on your site or they are "just numbers"?

    If so, it might really be easier, safer and more "cost efficient" to just add additional profile fields to the site called e.g. "Member ID" or similar and use it to store the "proper" ID (as printed on their membership cards).

    Best regards,
    Adam

  • Simon
    • Flash Drive

    Hi Adam,

    I'll save some time here and confirm that simply adding a Profile Field as 'Member ID' would work fine here. We have already done this in other areas of the site but if you could let me know how to add this field to the Membership plugin page then this would solve our problem completely!

  • Adam Czajczyk
    • Support Gorilla

    Hi Simon

    We have already done this in other areas of the site but if you could let me know how to add this field to the Membership plugin page then this would solve our problem completely!

    The Membership 2 Pro plugin doesn't let you create additional fields but it can use existing profile fields. You mentioned that you have already added them in some other areas of the site so I believe you want them to be consistent across entire site - so the same field/ID was displayed/used in Membership 2 Pro, correct?

    There's a "Profile Fileds" add on available in Membership 2 Pro on "Membership 2 -> Add-ons" page. Once you enable it, you'll get "Profile fields" tab on "Membership 2 -> Settings" page. If the field that you added is "compatible" it will be listed there and you'll be able to decide where in Membership 2 Pro it should be shown and whether it should be required field or not. This is, however, mostly for sign up/profile editing.

    If it doesn't help in your case and/or you would like to just display the value of that profile field somewhere in the Membership 2 Pro "area" on the site - could you please tell me:

    - how the field was added (was it via some plugin or a custom code? what was the plugin/code etc)?
    - where would you like to display it on site exactly?

    I'll then look into it to find a way.

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.