<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Never Use This Font &#187; wordpress</title>
	<atom:link href="http://neverusethisfont.com/blog/tags/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://neverusethisfont.com/blog</link>
	<description>Aaron Parecki is the co-founder of Geoloqi.com, and specializes in backend systems development.</description>
	<lastBuildDate>Mon, 11 Jul 2011 22:50:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>IMAP Authentication for WordPress 2.7.1</title>
		<link>http://neverusethisfont.com/blog/2009/02/imap-authentication-for-wordpress-271/</link>
		<comments>http://neverusethisfont.com/blog/2009/02/imap-authentication-for-wordpress-271/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 18:36:59 +0000</pubDate>
		<dc:creator>aaron</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Server Software]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://neverusethisfont.com/blog/?p=69</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>Due to some significant changes to the WordPress authentication mechanism, my original <a href="/blog/2008/08/imap-authentication-for-wordpress/">IMAP Authentication plugin</a> stopped working in version 2.7.1. I have updated the plugin to work in 2.7.1. The only difference is that users are no longer automatically created in WordPress if they have a valid IMAP account. I will try to add that back in soon, but for now this will do. </p>
<p>Download <a href="http://aaronpk.net/wp-imap-authentication/imap-authentication1.2.php">imap-authentication1.2.php</a></p>
<p><span id="more-69"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*
Plugin Name: IMAP Authentication 2
Version: 1.2
Plugin URI: http://blog.neverusethisfont.com/2009/02/imap-authentication-for-wordpress-271/
Description: Authenticate users using IMAP authentication. For Wordpress 2.7.1
Author: Aaron Parecki
Author URI: http://www.aaronparecki.com
&nbsp;
&nbsp;
Copyright 2009 by Aaron Parecki  (email : aaron@parecki.com)
&nbsp;
	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.
&nbsp;
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
&nbsp;
	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/</span>
&nbsp;
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_menu'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'IMAPAuthentication'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'admin_menu'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'lost_password'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'IMAPAuthentication'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'disable_password'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'retrieve_password'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'IMAPAuthentication'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'disable_password'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'password_reset'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'IMAPAuthentication'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'disable_password'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'show_password_fields'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'IMAPAuthentication'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'show_password_fields'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_authenticate_user'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'IMAPAuthentication'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'authenticate_user'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'check_password'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'IMAPAuthentication'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'check_password'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> is_plugin_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$mailbox</span> <span style="color: #339933;">=</span> IMAPAuthentication<span style="color: #339933;">::</span><span style="color: #004000;">get_mailbox</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$user_suffix</span> <span style="color: #339933;">=</span> IMAPAuthentication<span style="color: #339933;">::</span><span style="color: #004000;">get_user_suffix</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;div class=&quot;wrap&quot;&gt;
  &lt;h2&gt;IMAP Authentication Options&lt;/h2&gt;
  &lt;form name=&quot;imapauthenticationoptions&quot; method=&quot;post&quot; action=&quot;options.php&quot;&gt;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_nonce_field<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'update-options'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;update&quot; /&gt;
    &lt;input type=&quot;hidden&quot; name=&quot;page_options&quot; value=&quot;imap_authentication_mailbox,imap_authentication_user_suffix&quot; /&gt;
    &lt;fieldset class=&quot;options&quot;&gt;
      &lt;table width=&quot;100%&quot; cellspacing=&quot;2&quot; cellpadding=&quot;5&quot; class=&quot;form-table&quot;&gt;
        &lt;tr valign=&quot;top&quot;&gt;
        &lt;th width=&quot;33%&quot; scope=&quot;row&quot;&gt;&lt;label for=&quot;imap_authentication_mailbox&quot;&gt;Mailbox&lt;/label&gt;&lt;/th&gt;
        &lt;td&gt;&lt;input name=&quot;imap_authentication_mailbox&quot; type=&quot;text&quot; id=&quot;imap_authentication_mailbox&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">htmlspecialchars</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mailbox</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; size=&quot;80&quot; /&gt;&lt;br /&gt;eg: {mail.example.com/readonly}INBOX or {mail.example.com:993/ssl/novalidate-cert/readonly}INBOX&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr valign=&quot;top&quot;&gt;
        &lt;th scope=&quot;row&quot;&gt;&lt;label for=&quot;imap_authentication_user_suffix&quot;&gt;User Suffix&lt;/label&gt;&lt;/th&gt;
        &lt;td&gt;&lt;input name=&quot;imap_authentication_user_suffix&quot; type=&quot;text&quot; id=&quot;imap_authentication_user_suffix&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">htmlspecialchars</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user_suffix</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; size=&quot;50&quot; /&gt;&lt;br /&gt;A suffix to add to usernames (typically used to automatically add the domain part of the login).&lt;br /&gt;eg: @example.com&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/fieldset&gt;
    &lt;p class=&quot;submit&quot;&gt;
      &lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Save Changes'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
    &lt;/p&gt;
  &lt;/form&gt;
&lt;/div&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">class_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'IMAPAuthentication'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">class</span> IMAPAuthentication <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">/*
         * Add an options pane for this plugin.
         */</span>
        <span style="color: #000000; font-weight: bold;">function</span> admin_menu<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            add_options_page<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'IMAP Authentication'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'IMAP Authentication'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">/*
         * Return the mailbox option from the database, creating the option if it doesn't exist.
         */</span>
        <span style="color: #000000; font-weight: bold;">function</span> get_mailbox<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$cache_nonexistantoptions</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #000088;">$mailbox</span> <span style="color: #339933;">=</span> get_settings<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'imap_authentication_mailbox'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> <span style="color: #000088;">$mailbox</span> or <span style="color: #000088;">$cache_nonexistantoptions</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'imap_authentication_mailbox'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$mailbox</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'{localhost:143}INBOX'</span><span style="color: #339933;">;</span>
                IMAPAuthentication<span style="color: #339933;">::</span><span style="color: #004000;">add_mailbox_option</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mailbox</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #b1b100;">return</span> <span style="color: #000088;">$mailbox</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">/*
         * Add the mailbox option to the database.
         */</span>
        <span style="color: #000000; font-weight: bold;">function</span> add_mailbox_option<span style="color: #009900;">&#40;</span><span style="color: #000088;">$mailbox</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            add_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'imap_authentication_mailbox'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mailbox</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'The mailbox to try and log into.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">/*
         * Return the user_suffix option from the database, creating the option if it doesn't exist.
         */</span>
        <span style="color: #000000; font-weight: bold;">function</span> get_user_suffix<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$cache_nonexistantoptions</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #000088;">$user_suffix</span> <span style="color: #339933;">=</span> get_settings<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'imap_authentication_user_suffix'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> <span style="color: #000088;">$user_suffix</span> or <span style="color: #000088;">$cache_nonexistantoptions</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'imap_authentication_user_suffix'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$user_suffix</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
                IMAPAuthentication<span style="color: #339933;">::</span><span style="color: #004000;">add_user_suffix_option</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user_suffix</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #b1b100;">return</span> <span style="color: #000088;">$user_suffix</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">/*
         * Add the user_suffix option to the database.
         */</span>
        <span style="color: #000000; font-weight: bold;">function</span> add_user_suffix_option<span style="color: #009900;">&#40;</span><span style="color: #000088;">$user_suffix</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            add_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'imap_authentication_user_suffix'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user_suffix</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'A suffix to add to usernames (typically used to automatically add the domain part of the login).'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// custom error handler</span>
        <span style="color: #000000; font-weight: bold;">function</span> eh<span style="color: #009900;">&#40;</span><span style="color: #000088;">$type</span><span style="color: #339933;">,</span> <span style="color: #000088;">$msg</span><span style="color: #339933;">,</span> <span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #000088;">$line</span><span style="color: #339933;">,</span> <span style="color: #000088;">$context</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$error</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$error</span><span style="color: #339933;">.</span><span style="color: #000088;">$msg</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">function</span> authenticate_user<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$user</span><span style="color: #339933;">,</span> <span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Apparently this method is no longer called for users who are not in the WP database</span>
&nbsp;
			<span style="color: #000088;">$mbox</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imap_open</span><span style="color: #009900;">&#40;</span>IMAPAuthentication<span style="color: #339933;">::</span><span style="color: #004000;">get_mailbox</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_login</span><span style="color: #339933;">.</span>IMAPAuthentication<span style="color: #339933;">::</span><span style="color: #004000;">get_user_suffix</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$password</span><span style="color: #339933;">,</span> OP_HALFOPEN<span style="color: #339933;">|</span>OP_READONLY<span style="color: #009900;">&#41;</span> or <span style="color: #000088;">$error</span> <span style="color: #339933;">=</span> <span style="color: #990000;">imap_last_error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$mbox</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$userInfo</span> <span style="color: #339933;">=</span> get_userdatabylogin<span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_login</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #990000;">imap_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mbox</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> WP_User<span style="color: #009900;">&#40;</span><span style="color: #000088;">$userInfo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
				do_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wp_login_failed'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">user_login</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> WP_Error<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'incorrect_password'</span><span style="color: #339933;">,</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;strong&gt;ERROR&lt;/strong&gt;: Incorrect password. '</span><span style="color: #339933;">.</span><span style="color: #000088;">$error</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">function</span> check_password<span style="color: #009900;">&#40;</span><span style="color: #000088;">$unknown</span><span style="color: #339933;">,</span> <span style="color: #000088;">$enteredPassword</span><span style="color: #339933;">,</span> <span style="color: #000088;">$storedPassword</span><span style="color: #339933;">,</span> <span style="color: #000088;">$userID</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> WP_User<span style="color: #009900;">&#40;</span><span style="color: #000088;">$userID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> IMAPAuthentication<span style="color: #339933;">::</span><span style="color: #004000;">authenticate_user</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">,</span> <span style="color: #000088;">$enteredPassword</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">/*
         * Used to disable certain login functions, e.g. retrieving a
         * user's password.
         */</span>
        <span style="color: #000000; font-weight: bold;">function</span> disable_password<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            login_header<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Login'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;p class=&quot;message&quot;&gt;&lt;strong&gt;ERROR&lt;/strong&gt;: You can\'t do that here. This blog uses the IMAP login mechanism. Your password is set with your email account.&lt;/p&gt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'error'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">/*
         * Used to disable certain display elements, e.g. password
         * fields on profile screen.
         */</span>
        <span style="color: #000000; font-weight: bold;">function</span> show_password_fields<span style="color: #009900;">&#40;</span><span style="color: #000088;">$username</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://neverusethisfont.com/blog/2009/02/imap-authentication-for-wordpress-271/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
	</channel>
</rss>

