CakePHP : Accessing the logged in user
Once a user is logged in, you will often need some particular information about the current user. You can access the currently logged in user using AuthComponent::user() . This method is static, and can be used globally after the AuthComponent has been loaded. You can access it both as an instance method or as a static method: You can access all the user's information(fields) from the users table except the password. <?php // Use anywhere // Accesing user’s id AuthComponent :: user ( 'id' ); $_SESSION[' Auth '][' User' ][' id ']; // Accesing user’s username AuthCompo...