I need to record some data in the database for a user in the session (a custom add-on) and I'd been using the value returned from PHP's session_id() method, which works well enough.
When the user logs in, I then need to update the data with the logged in member's ID.
However I'm finding that when the user logs in, that session_id() is empty so I lose the link to what was in session for that user prior to login.
I had originally tried using $EE->session->userdata('session_id') but that was zero, which is why I ended up using the native session_id() method.
Does anybody have any suggestions for the best way of achieving this?