sokalsondha Posted April 5, 2020 Share Posted April 5, 2020 Dear Members hope all are still safe. Can some one help me make a hook which will generate a 8 digit random number for the custom client field. so what will be happen when customer register in our website the hook will add automatically a 8 digit number in the custom client field. the field name will be Account Number. the number will be unique in the database for each client. hope i able to explain the thing Kind Regards Mahim 0 Quote Link to comment Share on other sites More sharing options...
weelow Posted April 6, 2020 Share Posted April 6, 2020 I am trying to think how to apply it but if it is a randomly generated number through code when it gets to the database it might not end up unique as you requested. What I would do is create a custom field like you normally would then find that field in the database and change its structure to auto increment then do some limitation on that field to prevent the user from modifying it. So that it is a read only field. 0 Quote Link to comment Share on other sites More sharing options...
sokalsondha Posted April 6, 2020 Author Share Posted April 6, 2020 1 hour ago, weelow said: I am trying to think how to apply it but if it is a randomly generated number through code when it gets to the database it might not end up unique as you requested. What I would do is create a custom field like you normally would then find that field in the database and change its structure to auto increment then do some limitation on that field to prevent the user from modifying it. So that it is a read only field. thanks but hook can check in database for existing number... so thats how its became unique 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.