[Plugin: WPMU Ldap Authentication] Patch for Admin Toolbar to use LDAP add user page
-
The default behavior in WordPress 3.4.1 with WPMU Ldap Version 4 leaves the admin toolbar (at the top of the page by default) with the Local Add User page linked in the New->User option. I wrote a patch for WPMU Ldap that hooks in and replaces the link to the Local Add User page with a link to the Ldap Add User page.
diff -Naur --strip-trailing-cr a/wpmuldap/ldap_auth.php b/wpmuldap/ldap_auth.php --- a/wpmuldap/ldap_auth.php 2012-08-22 16:04:57.000000000 -0400 +++ b/wpmuldap/ldap_auth.php 2012-08-28 11:55:33.380330993 -0400 @@ -63,4 +63,6 @@ // disable default add user box add_filter('show_adduser_fields', 'wpmuLdapDisableShowUser'); + //override admin toolbar option for creating user accounts + add_action('wp_before_admin_bar_render', 'wpmuLdap_custom_admin_bar_render'); } diff -Naur --strip-trailing-cr a/wpmuldap/lib/wpmu_ldap.functions.php b/wpmuldap/lib/wpmu_ldap.functions.php --- a/wpmuldap/lib/wpmu_ldap.functions.php 2012-08-22 16:04:57.000000000 -0400 +++ b/wpmuldap/lib/wpmu_ldap.functions.php 2012-08-28 11:57:18.212333798 -0400 @@ -416,3 +416,21 @@ function wpmuLdapSSODisableReauth($login_url){ return str_replace('&reauth=1','',$login_url); } + + +/* ++ * Override the add user functionality in the admin toolbar to use the ++ * LDAP Add User page instead of the default WordPress add user page ++ */ +function wpmuLdap_custom_admin_bar_render() { + global $wp_admin_bar; + $wp_admin_bar->remove_menu('new-user'); + $wp_admin_bar->add_menu( array( + 'id' => 'new-user', + 'title' => 'User', + 'href' => admin_url() . "tools.php?page=wpmu_ldap_adduser.functions.php", + 'parent' => 'new-content', + 'meta' => array( + 'title' => _x( 'User', 'add new from admin bar' ), 'new-user' ), + )); +}
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘[Plugin: WPMU Ldap Authentication] Patch for Admin Toolbar to use LDAP add user page’ is closed to new replies.