The SimpleLDAP plugin by Cliff Griffin is exactly what I needed for a proof-of-concept WordPress site I’m working on, but it hasn’t been officially updated in a while and was not entirely compatible with WordPress v.3.5.

I’ve updated the plugin to eliminate the errors I was getting, and it now works fine on my site, but it could probably use some TLC from someone more experienced with working with WordPress.

The original version of the plugin I used as a basis is v1.4.0.5.1, available at http://wordpress.org/plugins/simple-ldap-login/.

I’ve provided my full set of updated files, zipped, and also the diff patches for the two files that were altered: Simple-LDAP-Login.php and Simple-LDAP-Login-Admin.php

I hope this helps someone else trying to get LDAP going with WordPress.


Download a zipped version of the updated plugin here:
simpleLDAPupdated_for_WP3.5.zip

Patches for the two files that were altered are given below.
Patch for Simple-LDAP-Login.php:

@@ -8,7 +8,7 @@ Author: Clifton H. Griffin II
 Author URI: http://clifgriffin.com
 */
 require_once( WP_PLUGIN_DIR."/simple-ldap-login/adLDAP.php");
-//require_once( ABSPATH . WPINC . '/registration.php'); //removed for WP5.3.5.1. compatibility
+require_once( ABSPATH . WPINC . '/registration.php');
 
 //Admin
 function simpleldap_menu()
@@ -18,10 +18,7 @@ function simpleldap_menu()
 
 function simpleldap_admin_actions()
 {
-   add_options_page("Simple LDAP Login", "Simple LDAP Login", "create_users", "simple-ldap-login", "simpleldap_menu");
-  // per http://tumbledesign.com/fix-notice-has_cap-was-called-with-an-argument-that-is-deprecated-since-version-2-0-in-wordpress/
-  //changed this for WP5.3.5.1. compatibility
-   // add_options_page("Simple LDAP Login", "Simple LDAP Login", 10, "simple-ldap-login", "simpleldap_menu");
+    add_options_page("Simple LDAP Login", "Simple LDAP Login", 10, "simple-ldap-login", "simpleldap_menu");
 }
 function simpleldap_activation_hook()
 {
@@ -56,7 +53,6 @@ $sll_options=array(
 "domain_controllers"=>explode(";",get_option("simpleldap_domain_controllers")),
 );
 
-//"$sll_options=".print_r($sll_options); //debug
 //For OpenLDAP
 $ar_ldaphosts = explode(";",get_option("simpleldap_domain_controllers"));
 $ldaphosts = ""; //string to hold each host separated by space
@@ -68,7 +64,6 @@ foreach ($ar_ldaphosts as $host)
 }
 define ('LDAP_HOST', $ldaphosts);
 define ('LDAP_PORT', 389);
-//define ('LDAP_PORT', 636); //I prefer 636 as default
 define ('LDAP_VERSION', 3);
 define ('BASE_DN', get_option('simpleldap_base_dn'));
 define ('LOGIN', get_option("simpleldap_ol_login"));
@@ -104,9 +99,7 @@ function sll_authenticate($user, $userna
 $auth_result = sll_can_authenticate($username, $password);
 if($auth_result == true && !is_a($auth_result, 'WP_Error'))
 {
-//$user = get_userdatabylogin($username); //http://codex.wordpress.org/Function_Reference/get_userdatabylogin
-$user = get_user_by('login', $username);//changed because get_userdatabylogin is deprecated
-
+$user = get_userdatabylogin($username);
 
 if ( !$user || (strtolower($user->user_login) != strtolower($username)) ) 

Patch for Simple-LDAP-Login-Admin.php

  
 //If admin options updated (uses hidden field)
-if ((isset($_POST['stage']))&& ($_POST['stage'] == 'process') )
-//if ($_POST['stage'] == 'process') 
+if ($_POST['stage'] == 'process') 
 {
     update_option('simpleldap_account_suffix', $_POST['account_suffix']);
 update_option('simpleldap_base_dn', $_POST['base_dn']);
@@ -104,21 +103,20 @@ if ((isset($_POST['stage']))&& ($_POST['
 
 }
 //Test credentials
-elseif ((isset($_POST['stage']))&& ($_POST['stage'] == 'test') )
-//elseif ($_POST['stage'] == 'test') 
+elseif ($_POST['stage'] == 'test') 
 {
 global $bool_test;
 
 //Temporarily change security mode for test. Store old setting.
 $temp_holder = get_option("simpleldap_security_mode");
-update_option("simpleldap_security_mode", "security_low");
-//update_option("simpleldap_security_mode", "security_high");
+update_option("simpleldap_security_mode", "security_high");
 
 $test_user = wp_authenticate($_POST['test_username'],$_POST['test_password']);
 
 //Restore security mode setting.
 update_option("simpleldap_security_mode", $temp_holder);
-if ((isset($test_user->ID) )&&($test_user->ID > 0))
+
+if ($test_user->ID > 0)
 {
 $bool_test = 1;
 }