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 8475073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:47:48+00:00 2026-06-10T17:47:48+00:00

How to update user information stored in auth session? without logout and login again.

  • 0

How to update user information stored in auth session? without logout and login again.

I think this function will do it.. but is it the best-practice?

function update($field, $value){
    $this->Session->write($this->Auth->sessionKey . '.' . $field, $value);
}
  • 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-10T17:47:50+00:00Added an answer on June 10, 2026 at 5:47 pm

    I’ve completed update function to get an array of new values. with keys (field name):

    public function update($fields, $values = null) {
        if (empty(parent::$_user) && !CakeSession::check(parent::$sessionKey)) {
            return false;
        }
        if (!empty(parent::$_user)) {
            $user = parent::$_user;
        } else {
            $user = CakeSession::read(parent::$sessionKey);
        }
        if (is_array($fields)) {
            if (is_array($values)) {
                $data = array_combine($fields, $values);
            } else {
                $data = $fields;
            }
        } else {
            $data = array($fields => $values);
        }
        foreach ($data as $field => $value) {
            if (isset($user[$field])) {
                $user[$field] = $value;
            }
        }
        return $this->login($user);
    }
    

    (thanks to tigrang for login function)

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

Sidebar

Related Questions

I have this query update user_remember_me set when='2012-07-06 05:44:27', hash='c8e9d2c0dd156b5c68d0b048e5daa948e6b8fac7' where user = '21';
I've got a function that stores temporary information generated for every user authenticated in
I understand how to update active user data via using a form... But how
what wrong with this Query ??? i need this Query. UPDATE user_preferences SET user_preferences_value
I've a user profile and would like allow the user update everything about himself(username,
I am building a desktop application that needs to update current user's status frequently.
I am trying to write a page in asp.net to update an user object
In general, how do you guys handle user update/data freshness interaction with the user
Having an interesting issue with redirects. On my user update page (at /username/edit), users
How would I make a UILabel update as a user enters text in a

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.