alexnolan
Forum Replies Created
-
Also, just noticed, here’s the ticket for auto-authentication on the developer’s bug tracker. Some useful comments on there.
https://bt.steindorff.de/view.php?id=3
One thing to note is that get_userdatabylogin($user_login) is now depreciated, so change that bit of the code for get_user_by(‘login’, $user_login). New auto_login() function should look like this:
function auto_login() { if (!is_user_logged_in() && isset($_SERVER['LOGON_USER'])) { $user_login = substr($_SERVER['LOGON_USER'], strrpos($_SERVER['LOGON_USER'],'\\')+1, strlen($_SERVER['LOGON_USER'])-strrpos($_SERVER['LOGON_USER'],'\\')); $user = get_user_by('login', $user_login); $user_id = $user->ID; wp_set_current_user($user_id, $user_login); wp_set_auth_cookie($user_id); do_action('wp_login', $user_login); } } add_action('init', 'auto_login');
What authentication method have you got set in IIS? The auto_login() function probably expects Integrated Windows Authentication only, might not work if you have anonymous enabled. It also seems to need 2 page refreshes to actually display the user as logged in, and of course there is no way to ever log out!
I’ve also used the IIS Authentication Plugin occasionally to add some extra methods, seems to work ok but compatibility problems with Dynamic Widgets & Buddypress.
https://www.iis.net/community/default.aspx?tabid=34&g=6&i=1500
I’d still like to see proper automatic AD authentication. The hack remains an unsatisfactory workaround in my book!
See my post from a few months ago for a functions.php based workaround. I believe it does work on IIS7.
Forum: Plugins
In reply to: [Auto-tags] [Plugin: Auto-tags] Broken or slow?I know this is an old post, but agreed, this plugin causes serious performance issues when saving / updating posts and saving menu trees. Even times your session out sometimes. Confirmed 3.0 – 3.2.1.
A quick fix for many people might be something like adding the following to your theme’s functions.php:
function auto_login() { if (!is_user_logged_in() && isset($_SERVER['LOGON_USER'])) { $user_login = substr($_SERVER['LOGON_USER'], strrpos($_SERVER['LOGON_USER'],'\\')+1, strlen($_SERVER['LOGON_USER'])-strrpos($_SERVER['LOGON_USER'],'\\')); $user = get_userdatabylogin($user_login); $user_id = $user->ID; wp_set_current_user($user_id, $user_login); wp_set_auth_cookie($user_id); do_action('wp_login', $user_login); } } add_action('init', 'auto_login');
Tested with IIS 6, Windows Authentication, no proxy (if you’re doing auto-login, you’ll probably be excluding the site from any proxying anyway).
Works seamlessly with IE passed credentials, prompts for other browsers, and doesn’t appear to clash with ADI at all, which is nice!
If you have any probs, try fiddling with the $user_login substring.