Title: User authentication
Last modified: August 23, 2018

---

# User authentication

 *  [ggedare](https://wordpress.org/support/users/ggedare/)
 * (@ggedare)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/user-authentication-3/)
 * I have been working on a custom plugin for my organization. The plugin basically
   provides a medium for users to register and login.
 * I created a custom database table in the WordPress database to store information
   about registered users. However, when working the wp_authentication_username_password
   function, it failed to authenticate users whose information was stored in the
   custom table lablled wp-finusers. After researching I then realized that, the
   function was using the default users table to authenticate users.
 * The reason I wanted to use a custom table was to separate registered users and
   the WordPress Administrative users.
 * My question, is there a WordPress Filter that will enable the wp_authentication_username_password
   to using the custom table to perform user authentication or will I have to reconfigure
   the wp-core files to enable me to do so?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [7 years, 9 months ago](https://wordpress.org/support/topic/user-authentication-3/#post-10616045)
 * Maybe this?
 * [https://codex.wordpress.org/Plugin_API/Filter_Reference/wp_authenticate_user](https://codex.wordpress.org/Plugin_API/Filter_Reference/wp_authenticate_user)
 *  Thread Starter [ggedare](https://wordpress.org/support/users/ggedare/)
 * (@ggedare)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/user-authentication-3/#post-10619293)
 * [@steve](https://wordpress.org/support/users/steve/) Stern, Sorry about not getting
   back to you. Was looking for a action/filter that could help me.
 * Thanks
 * I will let you if I can get it to work.
 * thanks
 *  Thread Starter [ggedare](https://wordpress.org/support/users/ggedare/)
 * (@ggedare)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/user-authentication-3/#post-10619470)
 * [@steve](https://wordpress.org/support/users/steve/), this what I have done after
   reading the link you provided.
 *     ```
       add_filter('wp_authenticate_user', 'custom_authentication',10 ,2);
   
       	function custom_authentication($emailAdd, $password) {
       		global $wpdb, $formErr;
   
       		if(1 > count($formErr->get_error_messages())){
       			$table = $wpdb->prefix.'finusers';
       			$sql = "SELECT * FROM $table WHERE email_address='$emailAdd' AND password='$password'";
       			$authenticate_user = $wpdb->query($sql);
   
       			if($authenticate_user!=0){
       				echo "Successful Authenticated user";
       			}else{
       				echo "Failed to authenticate user";
       			}
       		}
       	}
       ```
   
 * I still can get the user authenticated using this code, but is this the correct
   way to this? Any suggestions on adjusting this code would really be of great 
   help.
 * Thanks
    Gedare Dorke(@ggedare)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘User authentication’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [ggedare](https://wordpress.org/support/users/ggedare/)
 * Last activity: [7 years, 9 months ago](https://wordpress.org/support/topic/user-authentication-3/#post-10619470)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
