10-21-2016, 02:54 PM
I will say that vericode in the users table is a randomly generated 6 digit number, if that would happen to work for your purposes. In the event that say you only need a 4 digit random number you could echo that back cutting off the last 2 digits.
So that would look like
But...back to your question.
If you're going to modify core userspice files, like the join form, it is best to copy join.php over to usersc/
This allows you to mod these files without having our updates overwrite your changes.
So, I'd copy your file over to usersc and change line 24 to say
This allows UserSpice to find its main configuration file.
Then, around line 38, I would generate your random number. Let's say you need your own, custom 4 digit number...
Finally, since you are putting this info into the users table (which is where the join form is already updating), you just need to pass your random number into the existing array of info being updated. So let's say you called your column in the db random_number....
Right after line 170 and again on line 196 add this line...
That tells Userspice to take the random number you generated on line 38 and pass it into the database into the column, random_number
I hope that helps. Let me know if you have any issues.
So that would look like
Code:
$random = substr($user->data()->vericode, 0, -2);
But...back to your question.
If you're going to modify core userspice files, like the join form, it is best to copy join.php over to usersc/
This allows you to mod these files without having our updates overwrite your changes.
So, I'd copy your file over to usersc and change line 24 to say
Code:
<?php require_once '../users/init.php'; ?>
This allows UserSpice to find its main configuration file.
Then, around line 38, I would generate your random number. Let's say you need your own, custom 4 digit number...
Code:
$random = rand(0000,9999);
Finally, since you are putting this info into the users table (which is where the join form is already updating), you just need to pass your random number into the existing array of info being updated. So let's say you called your column in the db random_number....
Right after line 170 and again on line 196 add this line...
Code:
'random_number' => $random,
That tells Userspice to take the random number you generated on line 38 and pass it into the database into the column, random_number
I hope that helps. Let me know if you have any issues.