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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:08:21+00:00 2026-05-12T18:08:21+00:00

I want my ‘users’ table in my database to contain users of all different

  • 0

I want my 'users' table in my database to contain users of all different levels (members, moderators, admins, etc). So a column in my 'users' table is role. I want to be able to check the role to see if they have permission to log in to special parts of the application. How can I do this? Here is my auth adapter so far:

protected function _getAuthAdapter($formData)
{
    $dbAdapter = Zend_Db_Table::getDefaultAdapter();
    $authAdapter  = new Zend_Auth_Adapter_DbTable($dbAdapter);

    $authAdapter->setTableName('users');
    $authAdapter->setIdentityColumn('username');
    $authAdapter->setCredentialColumn('password');

    $authAdapter->setIdentity($formData['username']);
    $authAdapter->setCredential(md5($formData['password']));

    return $authAdapter;
}
  • 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-12T18:08:21+00:00Added an answer on May 12, 2026 at 6:08 pm

    If you’re not wanting to use Zend_Acl for this yet, try this:

    protected function getAuthAdapter()
    {
        if (null === $this->_auth)
        {
            $a = new Zend_Auth_Adapter_DbTable(
                Zend_Registry::get('db')
            );
    
            $a->setTableName('users')
              ->setIdentityColumn('email')
              ->setCredentialColumn('password');
    
            // Get the select object and
            // modify to check against whatever you want
            $s = $a->getDbSelect();
            $s->where('userType = ?', 'admin'); // Or whatever, you can see what I'm doing
    
            $this->_auth = $a;
        }
    
        return $this->_auth;
    }
    

    You can see that you can use getDbSelect() to get the actual Zend_Db_Select object that Zend_Auth is using and modify it as needed.

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

Sidebar

Related Questions

Want to insert all the Rows of a table in a new table with
Want the function to sort the table by HP but if duplicate HPs then
Want to populate dynamically combobox-listbox-drop-down using javascript. var table = document.createElement(table); var select =
Want an applescript droplet that opens files in QuickTime and mutes them all. The
want to get all db entries by a specific hash and return it as
want to remove all css rules from inline css but not to remove display
Want to sort Nulls and Blanks last and have read all the solutions that
want to learn details about how to do a better database design any suggested
Want to edit things like DIV size, color, positioning (absolute), height/width etc.
Want to get current datetime to insert into lastModifiedTime column. I am using MySQL

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.