Skip to content

Commit

Permalink
Adds Multisite-Setup
Browse files Browse the repository at this point in the history
  • Loading branch information
heiglandreas committed Oct 16, 2015
1 parent bc63c4e commit 3539640
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions authLdap.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: AuthLDAP
Plugin URI: https://github.com/heiglandreas/authLdap
Description: This plugin allows you to use your existing LDAP as authentication base for WordPress
Version: 1.4.10
Version: 1.5.0
Author: Andreas Heigl <a.heigl@wdv.de>
Author URI: http://andreas.heigl.org
*/
Expand All @@ -20,7 +20,9 @@ function authLdap_debug($message)

function authLdap_addmenu()
{
if (function_exists('add_options_page')) {
if (is_multisite() && is_super_admin()) {
add_submenu_page('settings.php', 'AuthLDAP', 'AuthLDAP', 'manage_options', 'settings.php', 'authLdap_options_panel');
} else if (function_exists('add_options_page')) {
add_options_page('AuthLDAP', 'AuthLDAP', 'manage_options', basename(__FILE__), 'authLdap_options_panel');
}
}
Expand Down Expand Up @@ -747,6 +749,7 @@ function authLdap_set_options($new_options = array())
}
}

add_action('admin_menu', 'authLdap_addmenu');
$hook = is_multisite() ? 'network_' : '';
add_action("{$hook}admin_menu", 'authLdap_addmenu');
add_filter('show_password_fields', 'authLdap_show_password_fields');
add_filter('authenticate', 'authLdap_login', 10, 3);
2 changes: 2 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Go to https://github.com/heiglandreas/authLdap
Please use the issuetracker at https://github.com/heiglandreas/authLdap/issues

== Changelog ==
= 1.5.0 =
* Adds Multisite-Setup-possibilities
= 1.4.10 =
* Cleanup by removing deprecated code
* Fixes issues with undefined variables
Expand Down

1 comment on commit 3539640

@chaplina
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a multisite install this would restrict changes to the 1st site (blog id = 1).

I need to test but even in a Network Activated environment I'm not sure a particular site would use authLDAP because the authLDAPOptions data would not exist in the wp_siteid_options table.

Implementing this would require changes to authLdap_load_options. In particular, you would want to use get_site_option.

i.e. My RFE gets complicated quickly once implementation begins.

Please sign in to comment.