Welcome Guest, Not a member yet? Register   Sign In
Community Auth

Hi there.

I am using Community Auth and I am trying to connect to my database, but it appears that I can only connect to the MEDIA database that the Community Auth code is using.

I have a JB_Controller which extends MY_Controller which extends Auth_Controller which extends CI_Controller.

I thought that is how I should do it in order to get access to the Community Auth stuff in my main code.

Can anyone shed some light on this?

Thank you for your help.


1) Community Auth only calls $this->load->database(); and make no attempt to choose a database or any connection settings. Those are all part of CodeIgniter's database configuration, which means that Community Auth is just using the default database connection. If your specific application uses the MEDIA database by default, then unless your override the _load_dependencies method in Auth_Controller, your Community Auth related tables would need to be added to that database.

2) The way you are extending base controllers should work just fine, although you haven't shared any code so it's just an assumption.

3) Are you using multiple databases?

Dear SB,

Thanks for taking the time to reply.

The weird bit is that I have no idea where this MEDIA database has been set up - I have a local server for testing, and I can see the MEDIA database, but I have no idea how that was created - perhaps dementia is setting in! That is the database where all the tables for Auth have been created.

When I change one of my Model functions to show the contents of say, the users table in there, it works fine. But if I reference a table that I have specified in the database that my connection settings are pointing at, it tells me there's no such table:

Table 'media.sermons' doesn't exist

These are the connection settings in the database.php files in the development version of my code:

'hostname' => 'localhost',
'username' => 'test_admin',
'password' => '*******',
'database' => 'test',
'dbdriver' => 'mysqli',

But my code appears to connect to a 'MEDIA' database on the local server!

Interestingly, in the test database mentioned above, all the tables for CommAuth are there - but they are all empty... the tables in the MEDIA database are where all the data actually resides!

I don't understand why the code is connecting to this MEDIA database when I don't appear to have specified that database anywhere in my code.

I am a bit stumped.


I hope you understand that given the nature of this mysterious database, I can't offer any suggestions.

Dear SB,

Absolutely - totally understand that. I think I may clear out all the CA tables and start again and see if I can get things to work this time.

Thanks for your help.


(12-24-2017, 07:33 AM)skunkbad Wrote: I hope you understand that given the nature of this mysterious database, I can't offer any suggestions.

Hello Brian.

I hope it is alright to send this PM.

I am new on this forum, I actually had to sign up because of you.

I want to use Community Auth,, especially the ACL features, to extend an open source developed with CodeIgniter

I have been having problems with "merging" of CA database with the existing project database.

Can you please guide me? What do I change?

I appreciate your kind guidiance.


Theme © iAndrew 2016 - Forum software by © MyBB