0

Building a membership site for a client and looking to create unique membership numbers for each member that signs up with a format of "MEMBER0000089" for example.

Looking to see if anyone knows how to customise existing user ids? or create a custom id which could create a membership number? Once the number is created we would want it to show in the user panel area on the dashboard so we are able to search activity via the 'membership number' and also so we are able to export the users into spreadsheets for records/admin etc.

Hope someone can help, willing to pay a developer if needed. :)

1
  • Katie, welcome to WPSE. This is a community of developers helping eachother out with specific questions. If you are looking for a developer you may find someone here, but your chances might be higher if you put your question to a jobs board in your vicinity.
    – cjbj
    Jun 23 '17 at 14:23
1

WordPress will automatically assign a unique ID to every user on the website. If possible, I'd suggest simply using that auto-generated ID. You can create a dashboard widget that only displays for admin users, and add whatever activity you like. When you display their ID, you can have it output "Member " and pad their WP ID, so it appears like "MEMBER00000001" for the admin, even though the actual ID in the database is simply "1".

Customizing existing user IDs is not advisable, since the user ID field in WordPress's database is "bigint" (i.e. it can only contain numbers, no letters).

If you really want to create your own member ID number in addition to WP's built-in user ID, I'd suggest adding custom user meta. You could create your own plugin that automatically adds your desired unique ID every time. You could say: if there are no existing users, set the first one to "MEMBER0000001", but if there are existing users, get the latest custom ID and add 1 to the number portion, then concatenate the string "MEMBER" with the new number.

There are also a number of user meta / registration plugins available. You can try some of those out and see whether they allow you to add this extra field in a way that's invisible to the user (since I assume you don't want users to type in their own ID).

2
  • Customizing existing user IDs is not advisable is great advice. If you are not 100% sure what you are doing I would stick with WP generated user IDs to avoid a mess down the road.
    – lowtechsun
    Jun 21 '17 at 15:19
  • What I really need to know how to do is add an extra ID that adds a membership number to each user when they sign up, I want this number to increase so the first member would be MEMBER0000001 and the second would be MEMBER0000002 and so on. I am unsure on how to set a pre populated user meta... Anyone have experience doing this?
    – Katie Wsi
    Jun 22 '17 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.