Created
January 21, 2012 16:51
-
-
Save chrisguitarguy/1653264 to your computer and use it in GitHub Desktop.
Check WordPress usernames/passwords remote.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Authenticate Users Remotely | |
Author: Christopher Davis | |
Author URI: http://www.christopherguitar.net/ | |
License: GPL2 | |
*/ | |
add_filter('xmlrpc_methods', 'wpse39662_add_login_method' ); | |
/** | |
* Filters the XMLRPC methods to allow just checking the login/pass of | |
* a given users | |
*/ | |
function wpse39662_add_login_method( $methods ) | |
{ | |
$methods['wpse39662.login'] = 'wpse39662_check_login'; | |
return $methods; | |
} | |
function wpse39662_check_login( $args ) | |
{ | |
$username = $args[0]; | |
$password = $args[1]; | |
$user = wp_authenticate( $username, $password ); | |
if( is_wp_error( $user ) ) | |
{ | |
return false; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment