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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:31:37+00:00 2026-05-15T02:31:37+00:00

I’m working on a model that tracks user data and stores it in a

  • 0

I’m working on a model that tracks user data and stores it in a session, where appropriate. Here’s the basic structure of it:

public function __construct() {
    parent::__construct();

    $this->load->database();
    $this->load->library('session');

    if (!is_null($this->session->userdata('user'))) {
        $arrData = $this->session->userdata('user');

        $this->_netID = $arrData['_netID'];
        $this->_fName = $arrData['_fName'];
        $this->_eventMgr = $arrData['_eventMgr'];
        $this->_accessMgr = $arrData['_accessMgr'];
        $this->_accessAcnt = $arrData['_accessAcnt'];
        $this->_accessEvnt = $arrData['_accessEvnt'];
        $this->_accessCMS = $arrData['_accessCMS'];
        $this->_accessReg = $arrData['_accessReg'];
        $this->_accessRep = $arrData['_accessRep'];
        $this->_accessPay = $arrData['_accessPay'];
        $this->_okEvents = $arrData['_okEvents'];
    }
}
public function __get($name) {
    switch($name) {
            default:
            if (function_exists('parent::__get')) {
                return parent::__get($name);
            } else {
                return $this->$name;
            }
    }
}
public function __set($name,$val) {
    switch($name) {
            default:
            if (function_exists('parent::__set')) {
                return parent::__set($name,$val);
            } else {
                 $this->$name = $val;               }
    }
}

The issue I’m having is right in the constructor. Whenever it hits the seventh line (checking if the user key is null) it errors out, saying:

A PHP Error was encountered

Severity: Notice

Message: Undefined property: SessionUser::$session

Filename: models/sessionuser.php

Line Number: 83

Fatal error: Call to a member function userdata() on a non-object in /usr/cwis/data/www-data/melioraweekenddev/system/application/models/sessionuser.php on line 38

Any ideas on why?

  • 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-15T02:31:38+00:00Added an answer on May 15, 2026 at 2:31 am

    My guess is you’re trying to load a library from within a model which is not directly possible.
    Try instead:

    public function __construct() {
        parent::__construct();
    
        $CI =& get_instance(); //Loads the codeigniter base instance (The object your controller is extended from. & for php4 compatibility
        $CI->load->database();
        $CI->load->library('session');
    
        if (!is_null($CI->session->userdata('user'))) {
        ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 400k
  • Answers 400k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer For the sake of anyone who doesn't want to look… May 15, 2026 at 4:08 am
  • Editorial Team
    Editorial Team added an answer This was because the version of SWIG I was using… May 15, 2026 at 4:08 am
  • Editorial Team
    Editorial Team added an answer Ok. done: we should create a ServiceSoapClinet . an example… May 15, 2026 at 4:08 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.