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
/printthread.php 16 require_once



UserSpice
4.3.9 during_user_creation.php $theNewId Off by Three - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26)
+--- Thread: 4.3.9 during_user_creation.php $theNewId Off by Three (/showthread.php?tid=981)



4.3.9 during_user_creation.php $theNewId Off by Three - mleary2001 - 02-26-2018

Hello,

I have found that the $theNewId php varible as used in the 'during_user_creation.php' file is not the same value as in join.php but is actually 3 less. In other words, I have to add three to update the additional fields in the same users table record.

Code:
dump($theNewId);
// off by -3 (minus three)
Code:
$db->update('users',$theNewId + 3,['account_id'=>Input::get('account_id')]);
// add three to update the correct record in users table.

- Mike




4.3.9 during_user_creation.php $theNewId Off by Three - dan - 02-26-2018

What happens if you go to the top of during_user_creation.php and do
$id = $db->lastId();
dump($id);
Is it right?


4.3.9 during_user_creation.php $theNewId Off by Three - mleary2001 - 02-27-2018

It is still off by three. No difference.


4.3.9 during_user_creation.php $theNewId Off by Three - mleary2001 - 02-27-2018

Thanks for taking the time to respond Dan.

To clarify, all of the original field values in join.php and _join.php are entered into the new record in the MySQL database. The off-by-three problem arises for the additional fields added, in this case the example account_id plus, area_code and phone_number are entered three rows above the new record. Quite a mystery to me!

- Mike


4.3.9 during_user_creation.php $theNewId Off by Three - mleary2001 - 03-07-2018

Update: The off-by-three problem does not exist on our test server, just the dev server.

-Mike


4.3.9 during_user_creation.php $theNewId Off by Three - mudmin - 03-08-2018

Hmm. Sorry this one has hung out there too long. Let me make an "official" ticket for it on userspice.com/bugs and we'll try to fix it on our end. I may be contacting you to get you to test a few fixes! Today is out for me, but hopefully things will be a little slower tomorrow.