Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vikramjeet-dev/caa8a223daed08abae9f2449077772d6 to your computer and use it in GitHub Desktop.
Save vikramjeet-dev/caa8a223daed08abae9f2449077772d6 to your computer and use it in GitHub Desktop.
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
header("Access-Control-Allow-Headers: X-Requested-With");
include('wp-load.php');
$usernme = $_GET['usermail'];
$pass = $_GET['password'];
$userpass = md5($pass);
if(isset($usernme) && !empty($pass)){
$user = get_user_by( 'login', $usernme );
if (wp_check_password( $pass, $user->data->user_pass, $user->ID) )
{
/*wp_setcookie($usernme, $pass, true);
wp_set_current_user($user->ID, $usernme);
do_action('wp_login', $usernme);*/
//wp_redirect(home_url());
$all_meta_for_user = get_user_meta($user->ID);
$json = json_encode($all_meta_for_user);
echo $json;
}
else
{ echo "Incorrect Password"; } }
else{ echo 'Something went wrong'; }
header('Content-type: application/json');
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment