Skip to content

Commit

Permalink
Error attempting to use auth->role_name_by_id()
Browse files Browse the repository at this point in the history
When attempting to use auth->role_name_by_id(), the library throws an
error, attempting to call method select on a non-object. Fixed by
checking to see if the Role_model class exists and, if not, loading it.
  • Loading branch information
mwhitneysdsu authored and sourcejedi committed Sep 7, 2012
1 parent 982776b commit 7661301
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bonfire/application/core_modules/users/libraries/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,10 @@ public function role_name_by_id($role_id=0)
}
else
{
if (! class_exists('Role_model'))
{
$this->ci->load->model('roles/role_model');
}
$results = $this->ci->role_model->select('role_id, role_name')->find_all();

foreach ($results as $role)
Expand Down

0 comments on commit 7661301

Please sign in to comment.