PHP Classes

PHP WordPress Login: Authenticate users of a WordPress installation

Recommend this page to a friend!
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 46%Total: 211 All time: 8,337 This week: 78Up
Version License PHP version Categories
habwplogin 1.0.3Freeware5PHP 5, User Management, Web services
Description 

Author

This class can authenticate users of a WordPress installation.

It can send a HTTP request to a script in a WordPress installation that verifies if the password is valid of a given user.

The script hab-wp-login.php is provided by this package and must be installed in the target WordPress installation.

Innovation Award
PHP Programming Innovation award nominee
November 2016
Number 2


Prize: PHP Tools for Visual Studio Personal license
Nowadays many sites use WordPress. WordPress has its own user account system.

This package can be used to authenticate users with login and password in a remote WordPress installation.

It sends a HTTP request to a script in this package to be installed in the remote WordPress site and it verifies if the given user login and password are correct.

This way you can implement Web applications with an existing user system from a given WordPress site you control.

Manuel Lemos
Picture of Haseeb Ahmad Basil
  Performance   Level  
Name: Haseeb Ahmad Basil is available for providing paid consulting. Contact Haseeb Ahmad Basil .
Classes: 11 packages by
Country: Pakistan Pakistan
Age: 26
All time rank: 6147 in Pakistan Pakistan
Week rank: 45 Up1 in Pakistan Pakistan Up
Innovation award
Innovation award
Nominee: 4x

Winner: 1x

Details

HabWpLogin

WP Login functionality for external sources.

Installation

Copy files from wp-site directory to the root of your WordPress website.

Copy files from other-site directory to where you want to access this API from.

How To Use

Send POST params user and pass to hab-wp-login.php located inside wp-site. And it will return user data like json_encoded: username, name, email, rank, capabilities etc.

To use script inside other-site. Simply include the HabWpLogin.php, to your code and call the HabWpLogin class. here is an example:

<?php

include "path/to/HabWpLogin.php";
//Login Data username and password
$data = [
		"user" => "user123",
		"pass" => "pass123",
	];
//Path to the hab-wp-login.php located on the server with wordpress installation.
$pathWp = "path/to/hab-wp-login.php";

//Contains the array with user information
$login = HabWpLogin::doLogin($data, $pathWp);

To use multiple authentications to keep the info about user updated, in the above mentioned test call you will get all kinds of data about user, one of those will be user_pass which will contain user's password's hash. You can authenticate using that with the following example, by simply adding another param hash:

include "path/to/HabWpLogin.php";
//Login Data username and password
$data = [
        "user" => "user123",
        "pass" => "$P$ABCDE123456789",
        "hash" => 1,
    ];
//Path to the hab-wp-login.php located on the server with wordpress installation.
$pathWp = "http://X/hab-wp-login.php";

//Contains the array with user information
$login = HabWpLogin::doLogin($data, $pathWp);
var_dump($login);

  Files folder image Files  
File Role Description
Files folder imageother-site (1 file)
Files folder imagewp-site (1 file)
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  other-site  
File Role Description
  Plain text file HabWpLogin.php Class Class source

  Files folder image Files  /  wp-site  
File Role Description
  Accessible without login Plain text file hab-wp-login.php Aux. Auxiliary script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:211
This week:0
All time:8,337
This week:78Up
 User Ratings  
 
 All time
Utility:66%StarStarStarStar
Consistency:66%StarStarStarStar
Documentation:66%StarStarStarStar
Examples:-
Tests:-
Videos:-
Overall:46%StarStarStar
Rank:3131