Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8081587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:46:44+00:00 2026-06-05T16:46:44+00:00

This is a mystery.. in my controller Add function i want to enter the

  • 0

This is a mystery.. in my controller Add function i want to enter the user’s id into the record being created. I put the $this->Session->read(‘Auth.User.id’) after the create statement. But it was always blank.. i found out i could get username and role but id was always empty.

I am following cake naming convention for the table and field names. Users table has:
id
username
role

Calling the Session and Auth I can get the user’s role, username, any other value from the table but not the id… very weird

$this->Session->read(‘Auth.User.role’) —-> this returns role

$this->Session->read(‘Auth.User.username’) —-> this returns username

$this->Session->read(‘Auth.User.id’) —-> this is blank!

Any ideas what might be happening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:46:47+00:00Added an answer on June 5, 2026 at 4:46 pm

    So the answer to my question (which i found out after a while on my own) is that after adding a new record the autonumber id isn’t put into the auth Session for current user. Cake does this at login, so you’d have to log out and log back in to get new id in Auth Session. However you could get the newly inserted user autonumber by using getInsertId() and then use that to update the Auth Session by using $this->Session->write(‘Auth.Model.id’, $this->Model->getInsertId()); – genoki 49 secs ago edit

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have this recursive function: int mystery(int n) { if ( n ==
So I have something like this: var xmlStatement:String = xmlObject.node[3].@thisValue; What mystery function do
Granted... this is a dumb question, but it's still a mystery to someone like
This code disabled mouse scroll functionality, when i click on the document. $(document).on(click, function
This function is in a Class file in App_Code folder Public Shared Function CRUD(ByVal
This is probably not a rocket science question, so forgive me for being a
I've been trying to solve this mystery almost 2 hours, this is giving me
this is one of most mystery feature in JavaScript, after assigning the object method
I know I'm reaching for straws here, but this one is a mystery... any
This afternoon I walked my iPhone 4 into the Apple Store to see if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.