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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:29:44+00:00 2026-06-15T12:29:44+00:00

In my view i am trying to display the current logged in users information

  • 0

In my view i am trying to display the current logged in users information and have figured i can do this by using

echo "Welcome back " .$this->Session->read('Auth.User.username'). "

This displays the username and i can use the same approach to display the other fields in that database row, however some of the other fields can update at anytime but does not update on the users page until they logout and login again.

Is this correct way to do it? or can this be done a better way and somehow put some code in the beforeFilter() in AppController to continue to update the variables on each page load?

  • 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-15T12:29:45+00:00Added an answer on June 15, 2026 at 12:29 pm

    I prefer to get the real time data instead of the session data

    var $uses = array('User');
    
    function beforeFilter(){
        $id = $this->Auth->user('id'); //Using the session's user id is fine because it doesn't change/update
        $user_data = $this->User->findById($id);
        $user_fname = $user_data['User']['fname'];
        $this->set('fname', $user_fname);
    }
    
    //In your view
    echo 'Welcome Back '. $fname . '!';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to display a partial view using a custom helper method. The only
I'm trying to display a dropdown list of users in my view. Here is
I have two apps, account and myapp. I'm trying to display in a view
I'm trying to display the current logged in user and its record in gridview.
I'm trying to find the users current subscription on the database and display it's
I am trying to display information from database. I have set $config['per_page'] to 2,
I am trying to display a list of users in a custom webpart using
I'm trying to display a view after user accepts location sharing. Here is the
I am trying to display only selected items in list view. public class Mact
I'm trying to create a detail view to display mostly textviews. I think that

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.