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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:00:27+00:00 2026-05-26T23:00:27+00:00

It should be simple, but it’s not. I have a library that is hoping

  • 0

It should be simple, but it’s not.

I have a library that is hoping to use other libraries, but something ain’t jiving.

Both libs live in system/cms/libraries because as far as I can tell, addons/shared_addons/libraries is utterly useless and the libraries need to be autoloaded (it seems that system/cms is essentially system/application but please correct me if wrong). An aside: just for kicks I put a library in shared_addons/libaries just to see if I could call if from a module; I couldn’t. Why is it there?

Lib1
-needs db
-needs lib2

Lib2
-needs session

Here’s what happens. Controller [module] loads; calls lib1 which calls lib2 which throws an error. Lib1 is to be called by all module controllers. Lib2 uses session data that is set earlier on and is only called by lib1.

In lib2 I use $CI=get_instance() to supposedly enable CI libs (e.g. database, session). However, I can’t get past “Fatal error: Call to a member function userdata() on a non-object”; which is called by

//system/cms/libraries/lib2.php
$this->CI =& get_instance();
//$this->load->library('database'); == "can't find class database"
$ekeyLoc = $this->CI->session->userdata('ronery'); 

now if I run this in a module controller, it works as expected.

So googling that error, a lot of “db not loaded”‘s come up. Just to make sure, I tried to load the database, but because eff me, it can’t find class ‘database’ NB: database is being autoloaded.

When you assign CodeIgniter super object, I’m assuming it’s grabbing the whole jabloney, right? I thought so. But to make sure, I decided to try and load the database class in a module/controller, which turns out, because eff me, couldn’t be found.

I tried looking through the pyroCMS docs to find out about any trickery, but there ain’t much, and none helpful to my situation.

Why can’t I load a core library from a module controller?

Why can’t I load a core library into a custom library in system/cms/libraries?

Why doesn’t the CodeIgniter super object I assign contain session/db crap?

Why can’t I load a library from /addons/shared_addons/library?

Why would a call to $this->session->userdata() work from a module controller, but not from a library in the system/cms/libraries folder even though CodeIgniter super object has been assigned?

Thanks.


After 2 days with no answer, I find it both frustrating and hilarious that continuing to search for help inevitably leads to this question being the top google result. FML.

  • 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-26T23:00:27+00:00Added an answer on May 26, 2026 at 11:00 pm

    First things first:

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

    That is not valid CodeIgniter code, like their documentation says it should be:

    $this->load->database();
    

    As you’ve already pointed out though this is autoloaded so there is no need to do that anyway.

    Why can’t I load a core library from a module controller?

    You can.

    Why can’t I load a core library into a custom library in system/cms/libraries?

    You can.

    Why doesn’t the CodeIgniter super object I assign contain session/db crap?

    It does.

    Why can’t I load a library from /addons/shared_addons/library?

    This was not possible in 1.3.x but should have been fixed in 1.3.2, if not has been fixed since in 2.0.

    I do not know what you are doing or why you are having such problems, but without any example code or a description of what version of PyroCMS you are using I cannot help any further.

    If you have been stuck for two days why have you not posted on our forums? If you HAVE posted on our forums (I didn’t see anything about it) you should have put a link in this post to your forum thread to help other people answer the questions.

    This is not the first time anyone has been stuck on the internet but you act like it is. Come on, you know how this works! 🙂

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

Sidebar

Related Questions

should be simple right? but have not found any anwsers :
This should be simple but for some reason I'm stuck. I have data that
Should have been simple but I guess not.. I downloaded the Prism 2.2 source
This should be simple but I have never done it before and didn't find
This should be simple but I cannot figure it out. I have this very
This should be simple but I guess I'm hitting a mental block- I have
This should be simple but I can't find anywhere that tells me how to
This should be simple but it's not working. I am trying to strip single
I know this should be simple but I can't make it work. I have
This should be simple but I can't find a solution: I have a custom

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.