<?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>Edward Stafford&#187; WordPress</title>
	<atom:link href="http://www.edwardstafford.com/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.edwardstafford.com</link>
	<description>Technologist, Artist, and Geek</description>
	<lastBuildDate>Thu, 12 Aug 2010 17:59:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>WordPress: Use Custom Fields To Add Keyword Metadata to Your Posts</title>
		<link>http://www.edwardstafford.com/2010/02/04/wordpress-use-custom-fields-to-add-keyword-meta-data-to-your-posts/</link>
		<comments>http://www.edwardstafford.com/2010/02/04/wordpress-use-custom-fields-to-add-keyword-meta-data-to-your-posts/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 11:00:10 +0000</pubDate>
		<dc:creator>Ed Stafford</dc:creator>
				<category><![CDATA[Code Mode]]></category>
		<category><![CDATA[blogs]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[How-to]]></category>
		<category><![CDATA[keywords]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[thematic]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.edwardstafford.com/?p=258</guid>
		<description><![CDATA[One of the short-comings with using WordPress is that it does not provide an easy, built-in way to include metadata for your web page descriptions and keywords (and rightfully so). Why Not? The reason is simply that WordPress cannot read your mind. I know it&#8217;s hard to believe when you consider what you can do [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_276" class="wp-caption alignleft" style="width: 262px"><img class="size-medium wp-image-276   " title="Keywords for edwardstafford.com" src="http://www.edwardstafford.com/wp-content/uploads/keywords-black-300x120.png" alt="Keywords at edwardstafford.com" width="252" height="101" /><p class="wp-caption-text">Keywords for edwardstafford.com</p></div>
<p>One of the short-comings with using WordPress is that it does not provide an easy, built-in way to include metadata for your web page descriptions and keywords (and rightfully so). Why Not? The reason is simply that WordPress cannot read your mind. I know it&#8217;s hard to believe when you consider what you can do with wordpress, but it&#8217;s true. The issue with Description and Keyword page metadata is that, to be truely effective, it should be created to  describe the content found on each individual page. It&#8217;s how search engines like google determine how to categorize and index each page. Now, there are some SEO &#8220;experts&#8221; who will argue that this information is not very relevant anymore, and I do agree with that for the most part, but there are still SEO benefits to including this metadata vs. not including it at all.</p>
<p>I&#8217;ve been giving this some thought lately and developed a couple ideas of how to add these features into a wordpress site without too much difficulty. A bulb went off in a moment clarity when I started to think about using the Custom Fields to store page specific metadata. I was even naive enough to think I was on to something new (should have known better) but as I started researching some ideas, I realized there were others already doing similar things. Oh well, a minor detail. I took my own approach to the idea anyway, if for no other reason than a learning exercise. Ultimately, this could be added as a premium feature to any custom theme using a couple hooks and some custom theme options magic.</p>
<p><span id="more-258"></span></p>
<h2>Okay smarty-pants! So how do we include description and keyword metadata?</h2>
<p>The solution isn&#8217;t difficult to implement and can be used to add page specific metadata inside the &lt;head&gt; tag of any wordpress page. In this example, I&#8217;m going to show you a simple solution, but with some creativity and a little thought, you can expand this to provide a more robust solution for your own needs.</p>
<h2>Part I: Defining a Custom &#8220;Keywords&#8221; Field</h2>
<p>Custom Fields are a little used gem found in the Posts and Pages page of the WordPress dashboard / admin back end and available when you add a new post or page, or edit an existing post or page.</p>
<div id="attachment_263" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-263 " title="New Custom Field" src="http://www.edwardstafford.com/wp-content/uploads/custom-fields1-300x152.png" alt="Create a new custom field" width="300" height="152" /><p class="wp-caption-text">Create a new custom field</p></div>
<p>To create a new custom field to use for your page or post keywords, scroll down to the <strong>Custom Fields</strong> section below the main editor and click the &#8220;<strong>Enter new</strong>&#8221; link.</p>
<p>That action will activate the input fields for &#8220;Name&#8221; and &#8220;Value&#8221;.</p>
<p>In the Name field type the name identifier you&#8217;d like to use. This identifier/name will be used to reference the custom field name/value pair later so make it something relevant to avoid confusion. For this example, I am using &#8220;<strong>keywords</strong>&#8220;.</p>
<p>In the Value field, type the string of keywords or phrases that you want to use as the keyword metadata string for the page/post. For this example, I am using <strong>wordpress, seo, metadata, custom fields</strong></p>
<div id="attachment_265" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-265" title="Add New Custom Field Inputs" src="http://www.edwardstafford.com/wp-content/uploads/custom-fields3-300x89.png" alt="" width="300" height="89" /><p class="wp-caption-text">Add New Custom Field Inputs</p></div>
<p>When you&#8217;re done, hit the &#8220;<strong>Add Custom Field</strong>&#8221; button.</p>
<p>If you have already created a <strong>&#8220;keywords&#8221; Custom Field</strong> for a previous page or post, you will have the option of selecting it in future pages and posts from the Name drop down menu.</p>
<div id="attachment_266" class="wp-caption aligncenter" style="width: 310px"><img class="size-medium wp-image-266" title="Custom Fields Menu" src="http://www.edwardstafford.com/wp-content/uploads/custom-fields-menu-300x114.png" alt="Custom Fields Menu" width="300" height="114" /><p class="wp-caption-text">Select from Custom Fields Menu</p></div>
<p>Select the Keywords item from the menu and then add the keywords or phrases for your new page to the Value field. When your done, make sure you hit the &#8220;<strong>Add Custom Field</strong>&#8221; button to confirm it.</p>
<p>That completes Part I. You now have a functional Custom Field assigned to your post/page.</p>
<p>Next up! Adding and understanding the code that generates the keyword metadata tag.</p>
<h2>Part II: The Magic Code.</h2>
<blockquote><p>function set_keywords(){<br />
global $post;<br />
$keywords = get_post_meta($post-&gt;ID, &#8216;keywords&#8217;, true);<br />
$default_keywords = &#8220;Your, selection, of, default, keywords&#8221;;<br />
$metatag= &#8220;&#8221;;</p>
<p>if (empty($keywords)){<br />
$keywords = $default_keywords;<br />
}<br />
if (is_home() || is_front_page()){<br />
$keywords = $default_keywords;<br />
}</p>
<p>$metatag=&#8221;\t&#8221;;<br />
$metatag.= &#8220;&lt;meta name=\&#8221;keywords\&#8221; content=\&#8221;";<br />
$metatag.= $keywords;<br />
$metatag.= &#8220;\&#8221; /&gt;&#8221;;<br />
$metatag.= &#8220;\n\n&#8221;;</p>
<p>echo $metatag;<br />
}<br />
add_action(&#8216;wp_head&#8217;, &#8216;set_keywords&#8217;);</p></blockquote>
<p>Adding this block of code to your Theme&#8217;s <strong>functions.php</strong> file will create and insert page specific Keyword Metadata into inside the &lt;head&gt; tag of your pages and posts assuming you have completed Part I.</p>
<h3>How the code works</h3>
<blockquote><p>function set_keywords(){</p></blockquote>
<p>The first line declares our function and sets the name &#8220;set_keywords&#8221;.</p>
<blockquote><p>global $post;<br />
$keywords = get_post_meta($post-&gt;ID, &#8216;keywords&#8217;, true);<br />
$default_keywords = &#8220;Your, selection, of, default, keywords&#8221;;<br />
$metatag= &#8220;&#8221;;</p></blockquote>
<p>These four lines set up the variables that will be used later in the function.</p>
<p><strong>global $post</strong> allows the function to reference values stored in an array containing post information that was previously set by WordPress outside of the current function.</p>
<p><strong>$keywords = get_post_meta($post-&gt;ID, &#8216;keywords&#8217;, true)</strong> is up next and sets our variable, <strong>$keywords</strong> to a string value equal to the &#8220;<strong>keywords</strong>&#8221; <strong>Custom Variable</strong> if it was set for the current page in Part I by calling the wordpress function <strong>get_post_meta()</strong>.</p>
<p>get_post_meta() is passed three arguments.</p>
<ol>
<li>The post ID (<strong>$post-&gt;ID</strong>)</li>
<li>a Custom Field Name reference (<strong>keywords</strong>)</li>
<li>a boolean value (<strong>true</strong>)</li>
</ol>
<p>These three arguments tell get_post_meta() to grab the &#8220;<strong>keywords</strong>&#8221; Custom Field value for a specific page (<strong>$post_ID</strong> = a reference to the current page) and return a string result (<strong>true</strong>).</p>
<p><strong><span style="color: #999999;">Note</span></strong><span style="color: #999999;">: If the Boolean argument were set to &#8220;false&#8221;, get_post_meta() would return an array object instead of a single string.</span></p>
<p><strong>$default_keywords = &#8220;Your, selection, of, default, keywords&#8221;</strong> sets a set of default keywords to use when the $keywords variable is empty or not set, or when you just want to include a general set of keywords.</p>
<p><strong>$metatag = &#8220;&#8221;</strong> rounds up the variables for the function and is used to build the metadata tag string that will be inserted into the page &lt;head&gt; tag.</p>
<blockquote><p>if (empty($keywords)){<br />
$keywords = $default_keywords;<br />
}</p></blockquote>
<p>The next step in the code is a conditional statement. Here I use the common PHP empty() function passing the <strong>$keywords</strong> variable as an argument to check whether the <strong>$keywords</strong> variable contains a value. If the empty() function returns true it means that <strong>$keywords</strong> does not contain a usable value, or that is has not been set. If this condition is true, it will set the value of $keywords to that of $default_keywords.</p>
<p>If the Keywords Custom Field was set for the current page, then the get_post_meta() function should have set the $keywords variable to a usable value equal to the Keyword Custom Field value. The condition will return false and the variable retains it&#8217;s Custom Field value.</p>
<blockquote><p>if (is_home() || is_front_page()){<br />
$keywords = $default_keywords;<br />
}</p></blockquote>
<p>Next I have another conditional statement that uses WordPress functions  to see if the current page is either the home page &#8211; <strong>is_home()</strong>,  or the &#8220;blog&#8221; page &#8211; <strong>is_front_page()</strong> If the current page matches either of these pages, I want to assign the value of <strong>$default_keywords</strong> to the <strong>$keywords</strong> variable.</p>
<p>The reason I do this is because the content on these pages is more dynamic and has a tendency to change often, effecting keyword relevancy. So I want to provide a generic set of default keywords instead of page content specific keywords.</p>
<p><strong><span style="color: #999999;">Note</span></strong><span style="color: #999999;">: It is possible, using more in-depth techniques not covered here, to also include the Keywords Custom Field for these pages and enable a set of more targeted keywords for them.</span></p>
<blockquote><p>$metatag=&#8221;\t&#8221;;<br />
$metatag.= &#8220;&lt;meta name=\&#8221;keywords\&#8221; content=\&#8221;";<br />
$metatag.= $keywords;<br />
$metatag.= &#8220;\&#8221; /&gt;&#8221;;<br />
$metatag.= &#8220;\n\n&#8221;;</p></blockquote>
<p>These lines are used to build the actual text string creating the metadata tag for our page&#8217;s &lt;head&gt; tag.  for example, if our page contained a keyword Custom Field with a value of  &#8221;keyword1, keyword2, keyword3&#8243;, the output for a blog post or single page would be:</p>
<p><strong>&lt;meta name=&#8221;keywords&#8221; content=&#8221;keyword1, keyword2, keyword3&#8243; /&gt;</strong></p>
<blockquote><p>echo $metatag;<br />
}</p></blockquote>
<p>Wrapping up the function we have <strong>echo $metatag </strong>followed by the closing bracket bringing our function to a close.  <strong>echo $metatag</strong> simply writes the output of the <strong>$metatag</strong> variable to the source of your web page inserting the keyword meta tag in the page&#8217;s &lt;head&gt; tag.</p>
<blockquote><p>add_action(&#8216;wp_head&#8217;, &#8216;set_keywords&#8217;);</p></blockquote>
<p>And finally bringing this code bit to an end is <strong>add_action(&#8216;wp_head&#8217;, &#8216;set_keywords&#8217;)</strong>. The add_action() function is a wordpress function used to hook your custom function to a WordPress action. In this case we are hooking our function <strong>set_keywords</strong> to the wordpress action <strong>wp_head</strong>. This is the piece that actually inserts your meta tag into the page &lt;head&gt; tag.</p>
<p><strong><span style="color: #999999;">Note</span></strong><span style="color: #999999;">: It is up to the individual theme developers to include the wp_head action in their themes, so there is a chance that your theme will not have it. In that case, check the documentation for your theme to see what action hooks are available to you.</span></p>
<p>That pretty much wraps it up!</p>
<div id="_mcePaste"><strong>Umm, Aren&#8217;t you forgetting something?</strong></div>
<p>By now you may be thinking, &#8220;Great, but what about the Description meta tag you mentioned?&#8221;.</p>
<p>You can use this same technique demonstrated here to create unique page descriptions with just a few minor code changes. Just replace keyword references with description references.</p>
<p>Do you have any suggestions to imporve on this? Find it helpful? Have some else to share? Leave a comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.edwardstafford.com/2010/02/04/wordpress-use-custom-fields-to-add-keyword-meta-data-to-your-posts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How-to: Active Directory Authentication with WordPress</title>
		<link>http://www.edwardstafford.com/2008/07/15/36/</link>
		<comments>http://www.edwardstafford.com/2008/07/15/36/#comments</comments>
		<pubDate>Tue, 15 Jul 2008 22:25:45 +0000</pubDate>
		<dc:creator>Ed Stafford</dc:creator>
				<category><![CDATA[IT Administration]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Social Media and Networking]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.edwardstafford.com/blog/2008/07/15/36/</guid>
		<description><![CDATA[Why Use Active Directory with WordPress? I recently set up a WordPress Blog internally for our company to use over our intranet to help improve communication, collaborate, share and develop ideas, and stay informed about company announcements or current events.. etc. One of the requirements I had was to allow authentication against our Active Directory. [...]]]></description>
			<content:encoded><![CDATA[<h2>Why Use Active Directory with WordPress?</h2>
<p>I recently set up a WordPress Blog internally for our company to use over our intranet to help improve communication, collaborate, share and develop ideas, and stay informed about company announcements or current events.. etc.</p>
<p>One of the requirements I had was to allow authentication against our Active Directory. Yes, we operate a Windows network primarily, but you can also authenticate against other LDAP directories as well. This was important from an IT position as well as the participants of the blog. I felt people would be more likely to participate if they didn&#8217;t have to manage separate user accounts for each service on the intranet. I also set up a Wiki that is Active Directory enabled. I&#8217;ll post about that at a later time. The point is, it makes little sense to create different credentials for each user with each new service. It not only becomes a hassle for IT to track and manage the accounts, it&#8217;s also a drag for participants to keep track of and manage their username and password pairs for each service. The result would most likely lead to lack of use and that is not what we want.</p>
<p>Integrating the existing Active Directory accounts means that each participant can access these services using the same credentials they use to access or log into their network accounts and desktops. When time comes to change passwords, you need only to update the Active Directory account and your done. Simple! What could be better?</p>
<h2><strong>Starting Point</strong></h2>
<p>The first thing we needed to do was find out how to include AD Authentication with WordPress 2.5. There are a small number of plugins that claim to allow AD Authentication, but from what I came across, most of them were older and no longer actively maintained. But&#8230;there were two in particular that still showed signs of being actively maintained and had promise.</p>
<p>The first was was aptly called &#8220;<a href="http://wordpress.org/extend/plugins/active-directory-authentication/" target="_blank">Active Directory Authentication</a>&#8221;</p>
<p>The other plugin and the ultimately the one I managed to successfully include is <a href="http://wordpress.org/extend/plugins/wpdirauth/" target="_blank">wpDirAuth</a>.</p>
<h2>The Trials</h2>
<p>Although I was able to get wpDirAuth to work with WordPress 2.5, there was a catch. The current &#8220;Official&#8221; release of wpDirAuth as of this writing is version 1.2 which is not compatible with WordPress 2.5 so there was some work involved to make this happen. I visited the wpDirAuth plugin page to look at the install directions. They seemed easy enough. It wasn&#8217;t until I actually installed and activated the plugin that I realized it wouldn&#8217;t work. My next stop was the support channel that the author set up to help troubleshoot install and authentication issues. It was here that I learned there was a patch already available and provided by a generous wpDirAuth user &#8211; <strong>Adam Yearout.</strong> I applied the patch and then tried to login with my network credentials again, and &#8230; No luck! By now I was scratching my head. Searching and reading all the information I could find, I finally found myself on the wpDirAuth Developer Support Channel. This was another channel set up specifically for developers. It was here that I uncovered some clues as to what was happening and a small code tweak that was necessary to overcome the problem. Apparently, the author of the plugin assumed that the login name was also the name associated with the Active Directory Account Email, which in most cases is true, but not always. For example username: johndoe would by default have an email johndoe@domain.com. In my case, my email and name and login name were not the same, so the logic that the plugin author used would not work. The good news is that the fix is a fairly simple one if you know where to look and the dev channel contained all the clues needed to find the info.</p>
<h2>Setting up wpDirAuth with WordPress 2.5</h2>
<p>For this how-to, I am using wordpress 2.5 installed on an Ubuntu 8.04 LTS server With Apache2 and PHP5. There is no GUI and I am not running an ftp server on this server so all settings and changes are completed using putty over SSL.<span id="more-36"></span></p>
<p>So lets get to it. Setting up AD Authentication was not as straight forward as I had hoped and required a few extra steps along the way.</p>
<p>The first step is to <a title="download the wpDirAuth plugin" href="http://downloads.wordpress.org/plugin/wpdirauth.1.2.zip">download the wpDirAuth plugin</a> from the WordPress plugins section.</p>
<p>From a terminal or if logged into the server via Putty, change to your home directory and get the latest version of the wpDirAuth plugin.</p>
<div class="myCode"><strong>cd /home/your_account_name<br />
wget http://downloads.wordpress.org/plugin/wpdirauth.1.2.zip</strong></div>
<div class="myNotes"><strong>Note</strong>: the file is compressed as a .zip so you may need to run:</p>
<p><strong>sudo apt-get install unzip</strong></p>
<p>before you can extract the files.</p></div>
<p>Next extract the files by executing:</p>
<div class="myCode"><strong>unzip wpdirauth.1.2.zip</strong></div>
<p>Now you have a new directory called wpdirauth.1.2 in your home directory.<br />
Move into the new directory and list the contents using</p>
<div class="myCode"><strong>cd wpdirauth.1.2<br />
ls</strong></div>
<p>Now you will see the wpdirauth directory. You need to move this entire directory to your WordPress plugins directory.</p>
<div class="myNotes"><strong>Note</strong>:The following instructions and paths are specific to my server. You may need alter these instructions to meet your needs.</div>
<p>To move the extracted wpdirauth directory, make sure you are in the wpdirauth.1.2 directory and execute the command:</p>
<div class="myCode"><strong>cp -r wpdirauth /var/www/wpblog/wp-content/plugins</strong></div>
<p>Now we need to move into the actual WordPress Blog directory where our files are hosted by executing the command:</p>
<div class="myCode"><strong>cd /var/www/wpblog/wp-content/plugins</strong></div>
<p>Now if you execute</p>
<div class="myCode"><strong>ls</strong></div>
<p>you should see the wpdirauth plugin folder. Once again, we will change directories and move into the hosted wpdirauth directory using:</p>
<div class="myCode"><strong>cd wpdirauth</strong></div>
<p>This is where the editing (and the fun) begins.<br />
Remember, we need to make some changes before we activate this plugin in WordPress 2.5 or it will not work.</p>
<h2>Patching the wpdirauth plugin</h2>
<p>Before making any changes to our files, it&#8217;s alway a good idea to make some backups.</p>
<p>From the wpdirauth execute the command:</p>
<div class="myCode"><strong>cp wpdirauth.php wpdirauth.php.orig</strong></div>
<p>Next apply the patch that was just downloaded. This patch will make changes to the wpdirauth.php file, and update the Plug-in version for 1.2 to 1.3</p>
<p>Apply the patch by executing the command:</p>
<div class="myCode"><strong>patch -p1 &lt; ../wpDirAuth-1.2-to-1.3.patch</strong></div>
<div class="myNotes">Note: You need patch installed to execute the following command. If Patch is not installed, you can install it by executing:</p>
<p><strong>sudo apt-get install patch</strong></div>
<h2>Editing the plugin</h2>
<p>Once the patch is installed, your Active Directory authentication should for most people. But we are not done yet.</p>
<p>There is an issue related to Active Directory users names and their email addresses. Active Directory user accounts that are also created with an email address, are by default given an address equal to the login name.<br />
For example an Active Directory user created with a login name of johndoe would have an email address of johndoe@domain.com. The problem arises in the way that wpDirAuth authenticates against Active Directory using the email address. If at some point, the users default email address is changed, the login name does not match the email address and authentication fails. The fix is a simple one if you know where to look.</p>
<p>To prevent authentication failure due to the login name and email mismatch, you need to make a small edit to the wpdirauth.php file. Start by executing the following command:</p>
<div class="myCode"><strong>sudo nano wpdirauth.php</strong></div>
<div class="myNotes"><strong>Note</strong>: I am using nano to edit files on the system. You can use any text editor you have available on your system.</div>
<p>Next, scroll through the file till you find the  wpDirAuth_auth() function at line 246. It should be about 1/4 of the way down the page. Edit this function as follows:</p>
<p>At about line 273 find the line</p>
<div class="myCode">if ($accountSuffix) $username .= $accountSuffix;</div>
<p>and delete or comment it out.</p>
<p>Next move down to about line 284 and look for the line that reads:</p>
<div class="myCode">$filterQuery = &#8220;($filter=$username)&#8221;;</div>
<p>Add a new line after this and enter the following:</p>
<div class="myCode">if ($accountSuffix) $username .= $accountSuffix;</div>
<p>Basicly, we are just moving the line &#8220;if ($accountSuffix) $username .= $accountSuffix;&#8221; down a few lines and adding it after the line &#8221; $filterQuery = &#8220;($filter=$username)&#8221;; &#8221;</p>
<p>This is the snippet of the the  wpDirAuth_auth() function after I made the changes look like this.</p>
<div class="myCode">function wpDirAuth_auth($username, $password)<br />
{<br />
&#8230;.&lt;PHP Code Lines removed for sample&gt;&#8230;.</p>
<p><strong>/**<br />
* This section commented out to enable AD email/username mismatch.<br />
* if ($accountSuffix) $username .= $accountSuffix;<br />
*/</strong></p>
<p><strong></strong>/**<br />
* Only setup protocol value if ldaps is required to help with older AD<br />
* @see http://groups.google.com/group/wpdirauth-support/&#8230;<br />
*/</p>
<p>$protocol = ($enableSsl) ? &#8216;ldaps://&#8217; : &#8221;;</p>
<p>if (!$filter) $filter = WPDIRAUTH_DEFAULT_FILTER;</p>
<p>$filterQuery = &#8220;($filter=$username)&#8221;;</p>
<p><strong> /**<br />
* Next Line added to enable AD email/username mismatch<br />
*/</strong></p>
<p>if ($accountSuffix) $username .= $accountSuffix;</p>
<p>// Connection pool loop &#8211; Haha, PooL LooP<br />
foreach ($controllers as $dc) {</p>
<p>&#8230;.&lt;PHP Code Lines removed for sample&gt;&#8230;.</p></div>
<h2>Activating the Plugin</h2>
<p>One requirement that may still be missing is php&#8217;s LDAP support. If you do not already have support for LDAP enabled in php, you will need to enable it before you can authenticate against the Active Directory.<br />
To enable LDAP in PHP, execute the following command</p>
<div class="myCode"><strong>sudo apt-get install php5-ldap</strong></div>
<p>At this point, and assuming everything went well, it&#8217;s time to log into your WordPress Blog as the WordPress Admin and navigate to the &#8220;settings&#8221; page. From here, you will see a &#8220;Directory Auth&#8221; link at the top of your settings page. click this link to access the Directory Auth setup page and fill in the required fields as they apply to your Active Directory set up.</p>
<p><strong>Enable Directory Authentication</strong> = yes<br />
<strong> Require SSL Login</strong> = Yes if you use SSL Auth, No if you do not.<br />
<strong> Enable SSL Connectivity</strong> = yes if you are using SSL or LDAPS connections, No if you are not.<br />
<strong> Directory Servers (Domain Controllers) </strong>= DNS Name or IP Address of your Active Directory Domain Controller<br />
<strong> Account  Filter</strong> = samAccountName or field to search the username to locate the directory profile. For AD, samAccountName should work.<br />
<strong> Account Suffix</strong> = @yourdomain.com &#8211; This is the suffix for you local domain usen in email addressing in the AD for you local network.<br />
<strong> Base DN</strong> = DC=domainname,DC=com &#8211; Note this will vary depending on you local network and complexity of your AD<br id="dp9s" /><strong>Bind DN</strong> = Blank if you allow Anonymous Binding to your Directory or a username use to pre-bind if you do not.<br />
<strong>Bind Password </strong>= Blank if you allow Anonymous Binding to your Directory or the password of the user used to pre-bind if you do not.</p>
<p>The remainder of the fields are self explanatory and are not critical to successful authentication.</p>
<div class="myNotes"><strong>Note</strong>: One of the easiest ways to get the correct Base DN for Active Directory is to use the ADSI Edit utility</div>
<p>Now save the changes and log out of the WordPress Admin account.<br />
Next attempt to login to WordPress using an Active Directory User Account.</p>
<p>You should now have Active Directory Authentication enabled and working with WordPress.</p>
<p>Remember, your mileage may vary depending on your specific needs and existing network and Active Directory structure.</p>
<p>Have any other tips, or want to share your experience with AD authentication in WordPress? Leave a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.edwardstafford.com/2008/07/15/36/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
