Auto-generate numeric username

12 years 10 months ago #166735 by apdt
Replied by apdt on topic Re: Auto-generate numeric username
I can't use CB Fields because I need to fetch and increment a value first (membership ID) before assigning to the username.

I can't use CB Queries because I don't do this on all plans, but only few selected plans. There is no conditional logic based on plan in CB Queries.

I do agree that Cb Fields is the more elegant way of doing it if it fits your membership model.

Please Log in to join the conversation.

12 years 10 months ago #167015 by ronsmart
Replied by ronsmart on topic Re: Auto-generate numeric username
I'm going to break down what I have done and what I want to accomplish. Maybe it will help some and hopefully someone can direct me in the right direction on what to do to finish this up.
http://peopletrader.net/images/mysqlfield.bmp
This works to create my cb_peopletraderid from the user ID and I only use it on some of my profile types through PROMA profile manager. I have an Add Profile menu item on my main nav for users with permission to be able to create profiles from the front end and the cb_peopletraderid will be used in place of username. Also these users that are created will be able to login using cb_peopletraderid instead of username. Can I accomplish this with in MySQL field using Output mode:"BOTH" and field Name: "username" to do so? Also standard profile types that use USERNAME to login.

Please Log in to join the conversation.

12 years 10 months ago #167034 by apdt
Replied by apdt on topic Re: Auto-generate numeric username
I never used MySQL field so I don't know if it works. But you can't make CB directly use cb_peopletraderid to login. CB can only use username or email so you have to copy the value of cb_peopletraderid assigned to the user to his username. This can be done either after registration, after confirmation, after approval, etc depending on your membership model.

So IMO the process is:
1. User registers
2. User is assigned an ID
3. Set his username to this ID
4. You can tell him that he can login using his ID

You need to decide how you will generate this ID (incremental, random number, etc), when you want the ID generated (registration, confirmation, approval, etc) and where you want to store this value (jos_comprofiler, create a new table, etc).

Note that if you generate & assign the ID on CB Subs plan activation, a plan is active when payment of that plan is received (instant when using credit card/paypal or when admin mark basket as paid for offline payment) regardless if the member is enabled/approved if your membership needs admin approval.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.207 seconds

Facebook Twitter LinkedIn