Random code insertion Topic is solved

Need help with the Administration of your Joomla! 3.x site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Post Reply
Sly036
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Sun Aug 25, 2019 1:40 pm

Random code insertion

Post by Sly036 » Sun Aug 25, 2019 1:55 pm

Hi !

Let me explain exactly what i need !

i need a unique key random alphanumeric code '7digit' when creating a new insciption and that code will be seen on customer profile, that code will be the same until account deleted.

i am not a geek in php-sql

so ! if anyone here can help me with that ! it will be great :)

thank you

harperlala
Joomla! Guru
Joomla! Guru
Posts: 643
Joined: Mon Aug 24, 2015 5:55 pm

Re: Random code insertion

Post by harperlala » Sun Aug 25, 2019 3:05 pm

you want code created when new user register? or which event you want to add?
or edit profile of user?

Sly036
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Sun Aug 25, 2019 1:40 pm

Re: Random code insertion

Post by Sly036 » Sun Aug 25, 2019 3:12 pm

Hi harperlala

yes exactly !

i want the code been created when user register and the possibility for the user to view that code in his profile. the code need to stay the same all time.

thank's

harperlala
Joomla! Guru
Joomla! Guru
Posts: 643
Joined: Mon Aug 24, 2015 5:55 pm

Re: Random code insertion

Post by harperlala » Sun Aug 25, 2019 3:28 pm

- in back-end/ user custom field/ create one custom file with type = text or integer
when create this, the value will display in user profile view.

- create one plugin and access to event "user create successfully".
the code for random 7 digit will add here. So when user create done, code will save in custom field that you create above.
how to save custom field value, you can check some guide:
https://joomla.stackexchange.com/questi ... user-field

if not create plugin, you can not save auto and random for code.

Sly036
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Sun Aug 25, 2019 1:40 pm

Re: Random code insertion

Post by Sly036 » Sun Aug 25, 2019 3:29 pm

Hi

i'll try to be more specify !

When a new user register, after completing his registration a unique 7 digits alphanumeric code is created, like a USER ID, and stored in database, in the user profile that code is shown for the user. that code is unique for each user. that code will be use for coupons and for interac transaction etc...

hope i've been more specify :)

Sly036
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Sun Aug 25, 2019 1:40 pm

Re: Random code insertion

Post by Sly036 » Sun Aug 25, 2019 3:31 pm

ok thanks alots

i'll try this method and gat back to you

Thank's

harperlala
Joomla! Guru
Joomla! Guru
Posts: 643
Joined: Mon Aug 24, 2015 5:55 pm

Re: Random code insertion

Post by harperlala » Sun Aug 25, 2019 3:42 pm

yes, need to build plugin because when you stop sale off or stop coupon, you can disable plugin in backend.
When use coupon again, you can enable it ..... easy to do in admin.

Sly036
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Sun Aug 25, 2019 1:40 pm

Re: Random code insertion

Post by Sly036 » Sun Aug 25, 2019 7:23 pm

Hi harperlala

Thanks for your support !

My probleme is creating a plug-in i'm no expert, and for the custom field i checked and i cant fugured exactly what to insert to get a 5 or 7 automatic code, nowhere on the net i can find the solutions, i dont really need to put on or off a plug-in cause that will always stay for the customer like the USER_ID.


actually those coupons will alway's be, we are a cathering food service for school and the parents will come on this site to be able to buy those coupons for their childrens,

I have another question for you ! if i create a false user with is ID starting at 1001, will the next subsciber will be 1002 ? cause it looks bad a new customer with an ID starting a 36 lol. or is there a plug-in out ther that can make me custom customer number.

Thanks in advance and i really appreciate your help.

harperlala
Joomla! Guru
Joomla! Guru
Posts: 643
Joined: Mon Aug 24, 2015 5:55 pm

Re: Random code insertion

Post by harperlala » Mon Aug 26, 2019 2:55 am

hi hi, you need to build and save random code and send user.
If you use user ID, other user can think about it and they can use without buy code. OK?

Sly036
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Sun Aug 25, 2019 1:40 pm

Re: Random code insertion

Post by Sly036 » Mon Aug 26, 2019 1:44 pm

Hi harperlala

done i've succed in changing USER_ID to a 7 digit id works fine juste had to creat a new false user in sql and give him a 7 digit number et Voila :)

Thx again for your time


Post Reply

Return to “Administration Joomla! 3.x”