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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:57:47+00:00 2026-05-27T21:57:47+00:00

Using Tank Auth for first time along with HMVC. In my application there are

  • 0

Using Tank Auth for first time along with HMVC. In my application there are 2 type of user one is say student and another is institute.
I created two modules for each user type and separated the tank auth library , both user’s registration, login and tables are different from each other.

Now if I try to add any other page which is common to both users like home page, Which library should be used.
I know there must be better solution to handle multiple user problem.
Please let me know where I’m doing wrong. And what should I do to tackle this problem.

  • 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-27T21:57:48+00:00Added an answer on May 27, 2026 at 9:57 pm

    You’re right, there’s a better way to handle this. Duplicating your user / registration system is the wrong way to go.

    You’ll need to modify TankAuth to include a user type column, and then check for that user type. I’d suggest a new column in the ‘users’ table for ‘user_role’:

    https://github.com/ilkon/Tank-Auth/blob/master/schema.sql

    You could handle the user_type as either an int or enum. I’d lean towards int since enum is harder to change later. You could also add a new table for user_roles but I usually just store these in a config file.

    Once the schema is altered, you’ll need to add a reference to the new column (along with possible options) in the Tank_Auth code. You’ll need to include it in creation, update (data is passed to model from the tank auth controller: controllers/auth.php) and lookup functions. I would add a lookup by user_role as well to the tank_auth model (application / models / tank_auth / users.php):

    function get_user_by_role($role)
    {
    $this->db->where('LOWER(user_role)=', strtolower($role));
    
    $query = $this->db->get($this->table_name);
    if ($query->num_rows() == 1) return $query->row();
    return NULL;
    }
    

    Lastly, you’ll want to set the user role to session on login so that you can track the user type (and what content / functionality they have access to).

    I’ve used Tank_Auth myself for several projects.

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

Sidebar

Related Questions

I am using Tank Auth for Codeigniter to facilitate user registration and login. Problem:
I'm using a reCaptcha class (the one that's included in the Tank Auth authentication
I am using Tank Auth for user authentication. I am using the database to
I am using the Tank Auth library for CodeIgniter. When a user is registered,
I found another bug in my cms where Im using the Tank Auth library
I am using Tank Auth authentication library with Codeigniter 2.0.3 (one version before the
This is my first time using authentication library. I followed this post to install
I am using Tank Auth, and require my users validate their email addresses. Upon
I'm using Tank Auth (it's working fine), but I can't get the form validation
I've got a login form and I'm using Tank Auth for form validation, etc.

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.