The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find id by username
#2
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

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.
  Reply


Messages In This Thread
Find id by username - by CromeX - 10-21-2016, 02:01 PM
Find id by username - by mudmin - 10-21-2016, 02:54 PM
Find id by username - by mudmin - 10-21-2016, 02:56 PM
Find id by username - by CromeX - 10-21-2016, 03:14 PM
Find id by username - by mudmin - 10-21-2016, 04:07 PM
Find id by username - by CromeX - 10-21-2016, 05:41 PM
Find id by username - by mudmin - 10-21-2016, 05:42 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)