Notifications
Clear all

[Closed] I need help with - User registration with code

8 Posts
3 Users
1 Likes
319 Views
Posts: 5
Topic starter
(@hybridelectric-forum)
Active Member
Joined: 6 months ago

I would like to add to the registration form a field where the user will be able to enter the CODE/PIN. Previously given by me, in an email or on a business card attached to the previously purchased product. I would like to create a closed forum and for that I need to register with a Code, how to do it so that such a field appears and registers only people who provide a PIN for example 12345.

 

It is important that the code for the user is chosen by me, it can be 1 code, but it would be best if there could be many of them. Maybe there is some plugin that works well with WPForo.

Please help me

7 Replies
Robert
Posts: 10503
Admin
(@robert)
Support Team
Joined: 8 years ago

Hi @hybridelectric-forum,

You can use wpForo User Custom Fields addon to add new fields in the registration, user profile and account pages.

Posts: 5
Topic starter
(@hybridelectric-forum)
Active Member
Joined: 6 months ago

I have already added the addon, but I don't know what field to add so that the Pin code has a set value/values.

Posts: 5
Topic starter
(@hybridelectric-forum)
Active Member
Joined: 6 months ago

<script> function validatePIN() { var enteredPIN = document.getElementById('pin').value; var allowedPINs = ['1234', '5678', '9876']; // Lista akceptowanych kodów PIN if (allowedPINs.includes(enteredPIN)) { alert('Poprawny kod PIN. Możesz się zarejestrować!'); } else { alert('Nieprawidłowy kod PIN. Spróbuj ponownie.'); } } </script>

 

I added this code to the HTML button, but it still doesn't work. Is there an option to change specific plugin files to add such a field?

2 Replies
dimalifragis
(@dimalifragis)
Joined: 4 years ago

Famed Member
Posts: 2577

@hybridelectric-forum Can you please use the CODE (<>) when posting code snipnets?

(@hybridelectric-forum)
Joined: 6 months ago

Active Member
Posts: 5

@dimalifragis This is plugin or what?

dimalifragis
Posts: 2577
(@dimalifragis)
Famed Member
Joined: 4 years ago

No, in the editor bar

 

1 Reply
(@hybridelectric-forum)
Joined: 6 months ago

Active Member
Posts: 5

@dimalifragis

<script> 
function validatePIN() { 

var enteredPIN = document.getElementById('pin').value;
var allowedPINs = ['1234', '5678', '9876']; // Lista akceptowanych kodów PIN 

if (allowedPINs.includes(enteredPIN)) { 
alert('Poprawny kod PIN. Możesz się zarejestrować!'); 
} 
else 
{ 
alert('Nieprawidłowy kod PIN. Spróbuj ponownie.'); 
} 
} 
</script>