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

  • Home
  • SEARCH
  • 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 6947103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:39:03+00:00 2026-05-27T13:39:03+00:00

I am storing userid in session user data, but the user data is only

  • 0

I am storing userid in session user data, but the user data is only available in one controller. I want to make the CodeIgniter sessions globally accessible.

I have this code

$custom_data = array(
            'userid'    =>  $user_id,
            'loggedin'  =>  TRUE
);

$this->session->set_userdata($custom_data);

I just loaded session library, and I have also used some hacks after searching around, but nothing is working the way I would like. How can I tackle this properly?

  • 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-05-27T13:39:04+00:00Added an answer on May 27, 2026 at 1:39 pm

    Hang on, there’s nothing about using sessions in CodeIgniter anywhere on the internet?

    This framework HAS been out for 5 years so I doubt that’s the case. Maybe you’ve not described your problem very well?

    By globally accessable if you mean you want to get it in other controllers then use:

    $this->session->userdata('userid');
    

    That will return your value.

    If by globally available you mean you want it available in other PHP files (not CodeIgniter) then thats a totally different thing. You need to use native PHP sessions to work natively with PHP and CodeIgniter sessions to work with CodeIgniter sessions. Simple! 🙂

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

Sidebar

Related Questions

I want to use cookies for storing userId during the session which lets to
I will be storing an array in session that will contain data entered by
I am thinking about making the switch to storing session data in encrypted cookies
I've got a Controller ActionResult that looks like this Function Edit(ByVal user As Domain.User,
The principle of sessions is to save data on server side that can be
I have a form for updating user data. It posts to this page: <?php
When a low-privilege non-administrator user logs into my web app successfully, I am storing
I'm building a user panel, and having some problems with data validation. As an
i am developing application in which i integrated the YAF forum successfully only one
What's the best way to cache web site user data in asp.net 4.0? I

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.