Search code examples
codeigniterion-auth

How can I show user's first name to the user after the user logged in


I am using Ion_Auth and I have a problem. I have looked for the solution but there is no progress yet.

As an example, there is a user and his name is Alex.

When Alex is logged in the portal, He should see his name Alex and then if he clicked his name, he will go to his user settings to edit his details. The problem is I can't show the first_name when a user have logged in.

How can I do that? I don't know what codes I can publish for this situation. Tell me what you need as code, I can publish if you need.


Solution

  • The easiest way is:

    $user = $this->ion_auth->user()->row();
    echo $user->first_name;