Login in Wordpress using external database data

I have a WP site and also have a external DB (means not WP DB) with users. The insertion process at that table uses the

I have a WP site and also have a external DB (means not WP DB) with users. The insertion process at that table uses the same algorithm as WP uses. What I'm need to do here is login in WP but using this external DB which is in the same host by the way. I check this links / and / and for the first is not what I'm want but for the second one is not compatible with WP 3+ and I'm using 3.3.1, any suggestion or docs or something else?

I have a WP site and also have a external DB (means not WP DB) with users. The insertion process at that table uses the same algorithm as WP uses. What I'm need to do here is login in WP but using this external DB which is in the same host by the way. I check this links http://www.tyssendesign.au/articles/cms/connecting-to-external-database-from-within-wordpress/ and http://wordpress/extend/plugins/external-database-authentication/ and for the first is not what I'm want but for the second one is not compatible with WP 3+ and I'm using 3.3.1, any suggestion or docs or something else?

Share Improve this question asked May 23, 2012 at 20:05 ReynierPMReynierPM 5373 gold badges12 silver badges26 bronze badges
Add a comment  | 

5 Answers 5

Reset to default 5

You can override the core wp_authenticate function.

You would need to create a custom plugin and declare a new version of wp_authenticate. The function accepts a username and a password and returns a WP $user object.

wp_authenticate is a 'pluggable' function and it is found in the wp-includes/pluggable.php file.

I needed more features than I could find elsewhere so I wrote my own plugin - External Login.

It has these main features:

  • Map a different DB table structure to be compatible with the WordPress fields
  • Handle different hashing methods from your external database (bcrypt, MD 2 4 and 5, SHA 256 384 and 512, and many many more)
  • Allow for different salting methods
  • Generate a copied version of the user in the database so that you can continue to use common WordPress features with users and roles
  • Map roles from your ‘external database’ to those found in WordPress e.g. a student in the ‘external database’ becomes an editor in the WordPress database.

Let me know if you require another feature :)

https://en-gb.wordpress/plugins/external-login/

Have you tried the External Database Authentication plugin? Just because it hasn't been updated in a while doesn't mean it won't necessarily work. At the very least you can look at their source code to see how they did what they did and use that as a basis to get what you need done.

Here is the code http://plugins.trac.wordpress/browser/external-database-authentication/trunk/ext_db_auth.php

I've just updated that old plugin for my needs. You can find the update @ http://www.7mediaws/extend/plugins/external-db-auth-reloaded

Yes, your plugin is awesome. Just what you need to improve and finalize your plugin is that in newer WordPress versions, there are two different tables that contain user data. They are wp_user and wp_usermeta. And in the plugin, it is provided only one table to authenticate. So if this feature goes right, definitely your plugin is 100% successful.

What else, is that there is a bug. As there is only one table to authenticate, so I couldn't authenticate user roles and sync them. This means when I enable external login, the time I logged out, and login the next time, I am of subscriber role, that I have specified if no roles matches. So i loosed my adminship too. Kindly help and understand.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745450925a4628263.html

相关推荐

  • Login in Wordpress using external database data

    I have a WP site and also have a external DB (means not WP DB) with users. The insertion process at that table uses the

    5小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信