<?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>Ben Lobaugh Online &#187; Computing</title>
	<atom:link href="http://ben.lobaugh.net/blog/category/computing/feed" rel="self" type="application/rss+xml" />
	<link>http://ben.lobaugh.net/blog</link>
	<description>/(bb&#124;[^b]{2})/</description>
	<lastBuildDate>Mon, 21 May 2012 03:14:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Developing for Windows Azure in WordPress</title>
		<link>http://ben.lobaugh.net/blog/11491/developing-for-windows-azure-in-wordpress</link>
		<comments>http://ben.lobaugh.net/blog/11491/developing-for-windows-azure-in-wordpress#comments</comments>
		<pubDate>Mon, 26 Mar 2012 17:34:58 +0000</pubDate>
		<dc:creator>blobaugh</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://ben.lobaugh.net/blog/?p=11491</guid>
		<description><![CDATA[Windows Azure is a very powerful and capable cloud hosting platform. Whether you are looking for highly scalable hosting, huge cloud storage, unshakable SQL Server, or massive CDN and caching, Windows Azure may have an answer for you. Windows Azure supports many open source technologies, including PHP and therefore it also handles WordPress. Running an [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Windows Azure" href="http://www.windowsazure.com" onclick="return TrackClick('http%3A%2F%2Fwww.windowsazure.com','Windows+Azure')" onclick="return TrackClick('http%3A%2F%2Fwww.windowsazure.com','Windows+Azure')" target="_blank">Windows Azure</a> is a very powerful and capable cloud hosting platform. Whether you are looking for highly scalable hosting, huge cloud storage, unshakable SQL Server, or massive CDN and caching, <a title="Windows Azure" href="http://www.windowsazure.com" onclick="return TrackClick('http%3A%2F%2Fwww.windowsazure.com','Windows+Azure')" onclick="return TrackClick('http%3A%2F%2Fwww.windowsazure.com','Windows+Azure')" target="_blank">Windows Azure</a> may have an answer for you. Windows Azure supports many open source technologies, including <a title="PHP" href="http://php.net" onclick="return TrackClick('http%3A%2F%2Fphp.net','PHP')" target="_blank">PHP</a> and therefore it also handles <a title="WordPress.org" href="http://wordpress.org" onclick="return TrackClick('http%3A%2F%2Fwordpress.org','WordPress.org')" target="_blank">WordPress</a>.</p>
<p>Running an application in "The Cloud" is a far different experience than running on a traditional shared or dedicated host, and to tap into some of the features of the platform the <a title="Microsoft Interoperability Team" href="http://www.interoperabilitybridges.com/" onclick="return TrackClick('http%3A%2F%2Fwww.interoperabilitybridges.com%2F','Microsoft+Interoperability+Team')" target="_blank">Microsoft Interoperability Team</a> has worked hard to deliver open source solutions to the community to enable applications to run faster and more smoothly. Let's run down a few of the resources currently available.</p>
<h2>Pre-built starter solution</h2>
<p>The MS-Interop team has released (on Github!!) a prepackaged solution that will get you a WordPress site fully configured to run on the Windows Azure platform in minutes. From there you can start customizing it with your own plugins and themes, as well as perform any custom development for Windows Azure itself.</p>
<p>The files can be found on <a title="Microsoft Interoperability Team Github account" href="https://github.com/Interop-Bridges" onclick="return TrackClick('https%3A%2F%2Fgithub.com%2FInterop-Bridges','Microsoft+Interoperability+Team+Github+account')" target="_blank">Interoperability Bridges Github</a> account under the <a title="WordPress scaffold for Windows Azure" href="https://github.com/Interop-Bridges/Windows-Azure-PHP-Scaffolders" onclick="return TrackClick('https%3A%2F%2Fgithub.com%2FInterop-Bridges%2FWindows-Azure-PHP-Scaffolders','WordPress+scaffold+for+Windows+Azure')" target="_blank">Windows Azure PHP Scaffolders</a> repository.</p>
<p>Additionally, two very good tutorials can be found on the <a title="Windows Azure PHP website" href="http://azurephp.interoperabilitybridges.com" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com','Windows+Azure+PHP+website')" target="_blank">Azure PHP</a> website for getting WordPress running:</p>
<ul>
<li><a title="How to deploy WordPress using the Windows Azure SDK for PHP scaffold" href="http://azurephp.interoperabilitybridges.com/articles/how-to-deploy-wordpress-using-the-windows-azure-sdk-for-php-wordpress-scaffold" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fhow-to-deploy-wordpress-using-the-windows-azure-sdk-for-php-wordpress-scaffold','How+to+deploy+WordPress+using+the+Windows+Azure+SDK+for+PHP+scaffold')" target="_blank">How to deploy WordPress using the Windows Azure SDK for PHP scaffold</a></li>
<li><a title="How to deploy WordPress Multisite to Windows Azure using the WordPress scaffold" href="http://azurephp.interoperabilitybridges.com/articles/how-to-deploy-wordpress-multisite-to-windows-azure-using-the-wordpress-scaffold" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fhow-to-deploy-wordpress-multisite-to-windows-azure-using-the-wordpress-scaffold','How+to+deploy+WordPress+Multisite+to+Windows+Azure+using+the+WordPress+scaffold')" target="_blank">How to deploy WordPress Mulisite to Windows Azure using the WordPress scaffold</a></li>
</ul>
<h2>Windows Azure Helper for WordPress</h2>
<p>The <a title="Windows Azure Helper for WordPress plugin" href="http://wordpress.org/extend/plugins/windows-azure-helper/" onclick="return TrackClick('http%3A%2F%2Fwordpress.org%2Fextend%2Fplugins%2Fwindows-azure-helper%2F','Windows+Azure+Helper+for+WordPress+plugin')" target="_blank">Windows Azure Helper for WordPress</a> is a very simple plugin that helps site administrators by adding or removing features that users should not have access to changing on a site running in Windows Azure.</p>
<p>The features list on the plugin page list the following (as of publishing this post):</p>
<p>Features</p>
<ul>
<li>Hide the Updates menu item under Dashboard</li>
<li>Hide the Add new plugin menu item under Plugins</li>
<li>Hide the Permalinks menu item under Settings</li>
</ul>
<h2>WP DB Abstraction</h2>
<p>If you want to use SQL Server for any reason, this is the plugin to have. Any WordPress install, whether on Windows Azure or not, can take advantage of existing (maybe corporate) database servers. When hosting in Windows Azure you will be using SQL Azure, which is SQL Server "in the cloud".</p>
<p>The <a title="WordPress WP DB Abstraction plugin" href="http://wordpress.org/extend/plugins/wordpress-database-abstraction/" onclick="return TrackClick('http%3A%2F%2Fwordpress.org%2Fextend%2Fplugins%2Fwordpress-database-abstraction%2F','WordPress+WP+DB+Abstraction+plugin')" target="_blank">WP DB Abstraction plugin</a> can be found in the WordPress repository.</p>
<h2>Windows Azure Storage for WordPress</h2>
<p>If you wish to take advantage of the massive cloud storage available in Windows Azure, or easily add content to the Windows Azure CDN, this plugin will help you do just that. With this plugin you can redirect file uploads to Windows Azure storage completely transparently to the user. A must have if you host on Windows Azure due to the non-shared nature of the cloud instances drives.</p>
<p>The <a title="Windows Azure Storage for WordPress" href="http://wordpress.org/extend/plugins/windows-azure-storage/" onclick="return TrackClick('http%3A%2F%2Fwordpress.org%2Fextend%2Fplugins%2Fwindows-azure-storage%2F','Windows+Azure+Storage+for+WordPress')" target="_blank">Windows Azure Storage for WordPress</a> plugin can be found in the WordPress repository.</p>
<h2>Windows Azure Developer Library</h2>
<p>The real meat and potatoes of this post is the <a title="Windows Azure Developer Library" href="http://wordpress.org/extend/plugins/windows-azure-developer-library/" onclick="return TrackClick('http%3A%2F%2Fwordpress.org%2Fextend%2Fplugins%2Fwindows-azure-developer-library%2F','Windows+Azure+Developer+Library')" target="_blank">Windows Azure Developer Library</a>. This plugin adds the library from the <a title="Windows Azure SDK for PHP" href="http://phpazure.codeplex.com/" onclick="return TrackClick('http%3A%2F%2Fphpazure.codeplex.com%2F','Windows+Azure+SDK+for+PHP')" target="_blank">Windows Azure SDK for PHP</a> to WordPress. Upon activation, developers will have access to all the features provided by the Windows Azure SDK for PHP in their plugins. The Microsoft Interoperability team maintains a great list of tutorials on the Azure PHP website to help developers, code examples included.</p>
<p>Be sure to check out the <a title="Windows Azure PHP tutorials" href="http://azurephp.interoperabilitybridges.com/tutorials" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Ftutorials','Windows+Azure+PHP+tutorials')" target="_blank">Azure PHP tutorials</a> page for updates as this list may be out of date</p>
<div>
<h3><strong><a title="Get Started" href="http://azurephp.interoperabilitybridges.com/get-started" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Fget-started','Get+Started')">Get Started</a></strong></h3>
<ul>
<li>Setup the Windows Azure Development Environment
<ul>
<li><a title="Setup the Windows Azure Development Environment automatically with the Microsoft Web Platform Installer" href="http://azurephp.interoperabilitybridges.com/articles/setup-the-windows-azure-development-environment-automatically-with-the-microsoft-web-platform-installer" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fsetup-the-windows-azure-development-environment-automatically-with-the-microsoft-web-platform-installer','Setup+the+Windows+Azure+Development+Environment+automatically+with+the+Microsoft+Web+Platform+Installer')"> Automatically with the Microsoft Web Platform Installer</a></li>
<li><a title="Setup the Windows Azure Development Environment manually" href="http://azurephp.interoperabilitybridges.com/articles/setup-the-windows-azure-development-environment-manually" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fsetup-the-windows-azure-development-environment-manually','Setup+the+Windows+Azure+Development+Environment+manually')">Manually</a></li>
</ul>
</li>
<li><a title="Setup the Windows Azure SDK for PHP" href="http://azurephp.interoperabilitybridges.com/articles/setup-the-windows-azure-sdk-for-php" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fsetup-the-windows-azure-sdk-for-php','Setup+the+Windows+Azure+SDK+for+PHP')">Setup the Windows Azure SDK for PHP</a></li>
<li><a href="http://azurephp.interoperabilitybridges.com/articles/obtaining-the-sample-files-used-in-the-tutorials" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fobtaining-the-sample-files-used-in-the-tutorials','Obtaining+the+sample+files+used+in+the+tutorials')">Obtaining the sample files used in the tutorials</a></li>
<li><a href="http://azurephp.interoperabilitybridges.com/articles/build-and-deploy-a-windows-azure-php-application" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fbuild-and-deploy-a-windows-azure-php-application','Build+and+deploy+a+Windows+Azure+PHP+application')">Build and deploy a Windows Azure PHP application</a></li>
<li><a title="Using the Windows Azure SDK for PHP" href="http://azurephp.interoperabilitybridges.com/articles/using-the-windows-azure-sdk-for-php" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fusing-the-windows-azure-sdk-for-php','Using+the+Windows+Azure+SDK+for+PHP')">Using the Windows Azure SDK for PHP</a></li>
</ul>
<h3><strong>Using the Command Line Tools</strong></h3>
<ul>
<li><a href="http://azurephp.interoperabilitybridges.com/articles/packaging-applications" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fpackaging-applications','Packaging+Applications')">Packaging Applications</a></li>
<li><a href="http://azurephp.interoperabilitybridges.com/articles/using-scaffolds" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fusing-scaffolds','Using+Scaffolds')">Using Scaffolds</a></li>
</ul>
<h3><strong>Windows Azure Storage</strong></h3>
<ul>
<li><a title="Tutorial - Using Table Storage" href="http://azurephp.interoperabilitybridges.com/articles/tutorial-using-table-storage" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Ftutorial-using-table-storage','Tutorial+-+Using+Table+Storage')">Using Table storage</a></li>
<li><a title="Tutorial - Using Blob Storage" href="http://azurephp.interoperabilitybridges.com/articles/tutorial-using-blob-storage" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Ftutorial-using-blob-storage','Tutorial+-+Using+Blob+Storage')">Using Blob storage</a></li>
<li><a title="Tutorial - Using Queue Service" href="http://azurephp.interoperabilitybridges.com/articles/tutorial-using-queue-service" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Ftutorial-using-queue-service','Tutorial+-+Using+Queue+Service')">Using Queue storage</a></li>
<li><a href="http://azurephp.interoperabilitybridges.com/articles/sharing-private-blobs" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fsharing-private-blobs','Sharing+private+blobs')">Sharing private blobs</a></li>
</ul>
<h3><strong>Windows Azure</strong></h3>
<ul>
<li><a href="http://azurephp.interoperabilitybridges.com/articles/enable-remote-desktop" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fenable-remote-desktop','Enable+Remote+Desktop')">Enable Remote Desktop</a></li>
<li><a href="http://azurephp.interoperabilitybridges.com/articles/diagnostics%E2%80%93part-i" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fdiagnostics%25E2%2580%2593part-i','Diagnostics+--+Part+I')">Diagnostics -- Part I</a></li>
<li><a href="http://azurephp.interoperabilitybridges.com/articles/diagnostics%E2%80%93part-ii" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fdiagnostics%25E2%2580%2593part-ii','Diagnostics+--+Part+II')">Diagnostics -- Part II</a></li>
<li><a href="http://azurephp.interoperabilitybridges.com/articles/resources-for-building-scalable-php-applications-on-windows-azure" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fresources-for-building-scalable-php-applications-on-windows-azure','Scaling+PHP+Applications')"> Scaling PHP Applications</a>
<ul>
<li><a href="http://azurephp.interoperabilitybridges.com/articles/scaling-php-applications-on-windows-azure-part-i-performance-metrics" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fscaling-php-applications-on-windows-azure-part-i-performance-metrics','Performance+Metrics')"> Performance Metrics</a></li>
<li><a href="http://azurephp.interoperabilitybridges.com/articles/scaling-php-applications-on-windows-azure-part-ii-role-management" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fscaling-php-applications-on-windows-azure-part-ii-role-management','Role+Management')"> Role Management</a></li>
<li><a href="http://azurephp.interoperabilitybridges.com/articles/scaling-php-applications-on-windows-azure-part-iii-performance-monitor" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fscaling-php-applications-on-windows-azure-part-iii-performance-monitor','Performance+Monitor')"> Performance Monitor</a></li>
<li><a href="http://azurephp.interoperabilitybridges.com/articles/scaling-php-applications-on-windows-azure-part-iv-using-worker-roles-for-automated-scaling" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fscaling-php-applications-on-windows-azure-part-iv-using-worker-roles-for-automated-scaling','Automated+Scaling+with+Worker+Roles')"> Automated Scaling with Worker Roles</a></li>
</ul>
</li>
<li><a title="Accessing Service Configuration settings from PHP" href="http://azurephp.interoperabilitybridges.com/articles/accessing-service-configuration-values-from-php" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Faccessing-service-configuration-values-from-php','Accessing+Service+Configuration+settings+from+PHP')">Accessing Service Configuration Settings from PHP</a></li>
<li><a href="http://azurephp.interoperabilitybridges.com/articles/using-a-custom-php-installation" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fusing-a-custom-php-installation','Using+a+custom+PHP+installation')">Using a custom PHP installation</a></li>
<li><a href="http://azurephp.interoperabilitybridges.com/articles/handling-sessions-with-table-storage" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fhandling-sessions-with-table-storage','Handling+sessions+with+Table+storage')">Handling sessions with Table storage</a></li>
<li><a href="http://azurephp.interoperabilitybridges.com/articles/handling-sessions-with-sql-azure" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fhandling-sessions-with-sql-azure','Handling+sessions+with+SQL+Azure+storage')">Handling sessions with SQL Azure storage</a></li>
</ul>
<h3><strong>Deploying to Windows Azure</strong></h3>
<ul>
<li><a href="http://azurephp.interoperabilitybridges.com/articles/deploying-your-first-php-application-to-windows-azure#new_deploy" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fdeploying-your-first-php-application-to-windows-azure%23new_deploy','Using+the+Windows+Azure+Portal')"> Using the Windows Azure Portal</a></li>
<li><a href="http://azurephp.interoperabilitybridges.com/articles/deploying-your-first-php-application-to-windows-azure#old_deploy" onclick="return TrackClick('http%3A%2F%2Fazurephp.interoperabilitybridges.com%2Farticles%2Fdeploying-your-first-php-application-to-windows-azure%23old_deploy','Using+the+legacy+Windows+Azure+Portal')"> Using the legacy Windows Azure Portal</a></li>
</ul>
</div>
<h2>Automated scaling</h2>
<p>I hear that there is a plugin in the works (maybe because I am one of the devs <img src='http://ben.lobaugh.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> ) that gives site admins the ability to set various trigger points (CPU, Memory, Network, etc) to have WordPress automagically start up more instances to handle extra traffic, or remove instances when traffic is low to save costs. If you are interested in testing this plugin please let me know.</p>
<h2>Happy developing!</h2>
<p>You now have all the resources you need to start taking advantage of the resources provided by Windows Azure from within WordPress.</p>
<p>If you have any question or would like help developing your Windows Azure WordPress applications feel free to drop myself or the <a title="Microsoft Interoperability Team contact page" href="http://www.interoperabilitybridges.com/contactus" onclick="return TrackClick('http%3A%2F%2Fwww.interoperabilitybridges.com%2Fcontactus','Microsoft+Interoperability+Team+contact+page')" target="_blank">Microsoft Interoperability team</a> a line.</p>
]]></content:encoded>
			<wfw:commentRss>http://ben.lobaugh.net/blog/11491/developing-for-windows-azure-in-wordpress/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress: Add or remove user contact methods in user profiles</title>
		<link>http://ben.lobaugh.net/blog/9064/wordpress-add-or-remove-user-contact-methods-in-user-profiles</link>
		<comments>http://ben.lobaugh.net/blog/9064/wordpress-add-or-remove-user-contact-methods-in-user-profiles#comments</comments>
		<pubDate>Wed, 14 Mar 2012 19:58:34 +0000</pubDate>
		<dc:creator>blobaugh</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://ben.lobaugh.net/blog/?p=9064</guid>
		<description><![CDATA[This post goes along with a presentation I gave at the February Seattle WordPress Developers Meetup. The Seattle WordPress group is pretty amazing and I highly recommend joining if you have the opportunity. Get the slides and code If you would like to view the slides used during the presentation they are available as a [...]]]></description>
			<content:encoded><![CDATA[<p>This post goes along with a presentation I gave at the <a title="February Seattle WordPress Developers Meetup" href="http://www.meetup.com/SeattleWordPressMeetup/events/48917872/" onclick="return TrackClick('http%3A%2F%2Fwww.meetup.com%2FSeattleWordPressMeetup%2Fevents%2F48917872%2F','February+Seattle+WordPress+Developers+Meetup')" target="_blank">February Seattle WordPress Developers Meetup</a>. The <a title="Seattle WordPress Meetup group" href="http://www.meetup.com/SeattleWordPressMeetup/" onclick="return TrackClick('http%3A%2F%2Fwww.meetup.com%2FSeattleWordPressMeetup%2F','Seattle+WordPress+Meetup+group')" target="_blank">Seattle WordPress</a> group is pretty amazing and I highly recommend joining if you have the opportunity.</p>
<h2>Get the slides and code</h2>
<p>If you would like to view the slides used during the presentation they are available as a PDF below:</p>
<p><a href="http://ben.lobaugh.net/blog/wp-content/uploads/2012/03/blobaugh-Feb2012-Extending_WordPress_User_Profiles1.pdf" onclick="return TrackClick('http%3A%2F%2Fben.lobaugh.net%2Fblog%2Fwp-content%2Fuploads%2F2012%2F03%2Fblobaugh-Feb2012-Extending_WordPress_User_Profiles1.pdf','blobaugh-Feb2012-Extending_WordPress_User_Profiles')">blobaugh-Feb2012-Extending_WordPress_User_Profiles</a></p>
<p>The complete code from this presentation can be found on the Seattle WordPress Github account</p>
<p><a title="WordPress Seattle Github" href="https://github.com/WordPress-Seattle/PresentationSource/blob/master/Feb2012-wpseaUserProfile/wpseaUserProfile.php" onclick="return TrackClick('https%3A%2F%2Fgithub.com%2FWordPress-Seattle%2FPresentationSource%2Fblob%2Fmaster%2FFeb2012-wpseaUserProfile%2FwpseaUserProfile.php','WordPress+Seattle+Github')" onclick="return TrackClick('https%3A%2F%2Fgithub.com%2FWordPress-Seattle%2FPresentationSource%2Fblob%2Fmaster%2FFeb2012-wpseaUserProfile%2FwpseaUserProfile.php','WordPress+Seattle+Github')" target="_blank">https://github.com/WordPress-Seattle</a></p>
<h2>Synopsis</h2>
<p>There are several built-in user contact methods that are already available on user profiles in WordPress, however the services there are not very widely used today. The built-in contact methods are: AIM, Yahoo IM, and Jabber. Of the three AIM and Yahoo IM are rarely used today, and most general audiences do not know what Jabber is (Jabber is pretty awesome and has wide ranges of uses. Google, for instance, uses Jabber for their chat network). More people today are using services such as Twitter or Facebook, or LinkedIn, so it probably makes sense to update the list of contact methods with whichever are most correct for your site.</p>
<p>What this post will show you is how to tap into the user profile to get rid of unneeded contact methods and add a new one for a user's Twitter handle. Additionally, when we are done each post will show the post author information box below the content. This is to highlight how easy it is to use the new contact methods to display on the frontend.</p>
<h2>Filters</h2>
<p>Recall that filters are similar to hooks, except that filters are designed to alter output instead of trigger an event. For our purposes we will be tapping into two filters, one which will allow us access to the user's contact methods and the other to post content.</p>
<p>We will be using the following two filters:</p>
<ul>
<li><a title="Codex Filter Reference: user_contactmethods" href="http://codex.wordpress.org/Plugin_API/Filter_Reference/user_contactmethods" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org%2FPlugin_API%2FFilter_Reference%2Fuser_contactmethods','Codex+Filter+Reference%3A+user_contactmethods')" target="_blank">user_contactmethods</a><br />
Holds a list of contact methods on a profile</li>
<li><a title="WordPress Codex Filter Reference: the_content" href="http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org%2FPlugin_API%2FFilter_Reference%2Fthe_content','WordPress+Codex+Filter+Reference%3A+the_content')" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org%2FPlugin_API%2FFilter_Reference%2Fthe_content','WordPress+Codex+Filter+Reference%3A+the_content')" target="_blank">the_content</a><br />
Holds the content of a post</li>
</ul>
<h2>Setup the user_contactmethods filter</h2>
<p>Filters are easily created using the <a title="WordPress Codex Function Reference: add_filter()" href="http://codex.wordpress.org/Function_Reference/add_filter" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org%2FFunction_Reference%2Fadd_filter','WordPress+Codex+Function+Reference%3A+add_filter%28%29')" target="_blank">add_filter()</a> function. This function takes several arguments, however will are only focusing on the first two, which are the WordPress filter name and the name of our custom function to send the filter to. Setup the filter with the following code:</p>
<pre class="php">add_filter<span style="color: #66cc66;">&#40;</span> ‘user_contactmethods’, ‘wpsea_setup_user_profile’ <span style="color: #66cc66;">&#41;</span>;</pre>
<p>When calling our custom function, wpsea_setup_user_profile(), a variable containing an array of the available contact methods will be passed.</p>
<pre class="php"><span style="color: #000000; font-weight: bold;">function</span> wpsea_setup_user_profile <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$user_contactmethods</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span></pre>
<p>By default the following exist: AIM, Yahoo Messenger, Jabber</p>
<h2>Remove unused contact methods</h2>
<p>Contact methods are stored in the passed in parameter, which is an array, and can be removed using the built-in PHP method to remove array elements, unset(). None of the existing contact methods are needed so let’s get rid of them all:</p>
<pre class="php"><span style="color: #000000; font-weight: bold;">function</span> func_name <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$user_contactmethods</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <a href="http://www.php.net/unset"><span style="color: #000066;">unset</span></a><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$user_contactmethods</span><span style="color: #66cc66;">&#91;</span>‘aim’<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span>;
    <a href="http://www.php.net/unset"><span style="color: #000066;">unset</span></a><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$user_contactmethods</span><span style="color: #66cc66;">&#91;</span>‘yim’<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span>;
    <a href="http://www.php.net/unset"><span style="color: #000066;">unset</span></a><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$user_contactmethods</span><span style="color: #66cc66;">&#91;</span>‘jabber’<span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
<h2>Add a new contact method</h2>
<p>This is the really complex part, adding a new contact method (sarcasm). The WordPress core developers have made this very easy on us by providing the user contact methods as an array. To create a new one just create a new, uniquely named, element in the array and viola, a new user contact field will show when editing the user's profile. Make sure to pick something that makes sense when naming the array element.</p>
<pre class="php"><span style="color: #000000; font-weight: bold;">function</span> wpsea_setup_user_profile <span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$user_contactmethods</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #0000ff;">$user_contactmethods</span><span style="color: #66cc66;">&#91;</span>‘twitter’<span style="color: #66cc66;">&#93;</span> = ‘Twitter Handle’;
<span style="color: #66cc66;">&#125;</span></pre>
<h2>Take a peek</h2>
<p>If we have done everything correctly you should now be able to activate the plugin and see the changes you made on your profile</p>
<p><a href="http://ben.lobaugh.net/blog/wp-content/uploads/2012/03/wp_user_contact_methods.jpg" onclick="return TrackClick('http%3A%2F%2Fben.lobaugh.net%2Fblog%2Fwp-content%2Fuploads%2F2012%2F03%2Fwp_user_contact_methods.jpg','wp_user_contact_methods')"><img class="wp-image-9071 alignnone" style="border: 1px solid black;" title="wp_user_contact_methods" src="http://ben.lobaugh.net/blog/wp-content/uploads/2012/03/wp_user_contact_methods-600x166.jpg" alt="" width="600" height="166" /></a></p>
<h2>Move to the front</h2>
<p>Well, we have our backend all spiffed up now with the new contact methods, but unless users only look at profiles from within the backend you will probably be wanting to know how to show your new contact method to visitors on the frontend, this is quite simple. If you are following along with my presentation slides you will notice that I am going to diverge here. The slides explain the various functions used to create our author information box, however I am skipping that here and getting right down to the code.</p>
<p>The <a title="WordPress Codex Function Reference: get_the_author_meta" href="http://codex.wordpress.org/Function_Reference/get_the_author_meta" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org%2FFunction_Reference%2Fget_the_author_meta','WordPress+Codex+Function+Reference%3A+get_the_author_meta')">get_the_author_meta()</a> function allows frontend developers and designers access to any of the user's profile fields. get_the_author_meta is usually used within <a title="WordPress Codex Manual: The Loop" href="http://codex.wordpress.org/The_Loop" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org%2FThe_Loop','WordPress+Codex+Manual%3A+The+Loop')" target="_blank">The Loop</a> and gets the current post author automagically, however it can be used anywhere and an optional user id supplied. For our purposes we will be using code similar to:</p>
<pre class="php"><span style="color: #0000ff;">$twitter_handle</span> = get_the_author_meta<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'twitter'</span> <span style="color: #66cc66;">&#41;</span>;</pre>
<p>Now we need to setup a filter for <a title="WordPress Codex Filter Reference: the_content" href="http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org%2FPlugin_API%2FFilter_Reference%2Fthe_content','WordPress+Codex+Filter+Reference%3A+the_content')" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org%2FPlugin_API%2FFilter_Reference%2Fthe_content','WordPress+Codex+Filter+Reference%3A+the_content')" target="_blank">the_content</a>, which is done with the following line of code:</p>
<pre class="php">add_filter<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'the_content'</span>, <span style="color: #ff0000;">'wpsea_post_user_profile'</span> <span style="color: #66cc66;">&#41;</span>;</pre>
<p>The rest of the code I will give you in a dump because it is regular display code that should make sense to you already, if not check the <a title="WordPress Codex" href="http://codex.wordpress.org" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org','WordPress+Codex')" target="_blank">Codex</a> or leave a comment and I will add more details.</p>
<pre class="php">&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> wpsea_post_user_profile<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$content</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> !is_singular<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'post'</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$content</span>;
&nbsp;
    <span style="color: #0000ff;">$id</span> = get_the_author_meta<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'ID'</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #0000ff;">$s</span> = <span style="color: #ff0000;">'
&lt;div id=&quot;author-bio&quot; style=&quot;border: 1px dotted #000; padding: 5px&quot;&gt;'</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Author gravatar</span>
    <span style="color: #0000ff;">$s</span> .= <span style="color: #ff0000;">'
&lt;div id=&quot;author-avatar&quot; style=&quot;float:left; margin-right: 10px&quot;&gt;'</span> . get_avatar<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$id</span>, <span style="color: #ff0000;">'150'</span> <span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">&quot;&lt;/div&gt;
&nbsp;
&quot;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Author info</span>
    <span style="color: #0000ff;">$s</span> .= <span style="color: #ff0000;">'
&lt;div id=&quot;the-author-info&quot; style=&quot;text-align:left; width: 100%&quot;&gt;'</span>;
&nbsp;
        <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$url</span> = get_the_author_meta<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'user_url'</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
            <span style="color: #0000ff;">$s</span> .= <span style="color: #ff0000;">'&lt;strong&gt;&lt;a href=&quot;'</span> . <span style="color: #0000ff;">$url</span> . <span style="color: #ff0000;">'&quot;&gt;'</span> . get_the_author<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">'&lt;/a&gt;&lt;/strong&gt;'</span>;
        <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
            <span style="color: #0000ff;">$s</span> .= <span style="color: #ff0000;">'&lt;strong&gt;'</span> . get_the_author<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">'&lt;/strong&gt;'</span>;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #0000ff;">$s</span> .= <span style="color: #ff0000;">'
&nbsp;
'</span> . get_the_author_meta<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'description'</span> <span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">'
&nbsp;
'</span>;
&nbsp;
        <span style="color: #0000ff;">$s</span> .= <span style="color: #ff0000;">'&lt;a href=&quot;'</span> . get_author_posts_url<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$id</span> <span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">'&quot;&gt;All posts by '</span> . get_the_author<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">'&lt;/a&gt;'</span>;
        <span style="color: #0000ff;">$s</span> .= <span style="color: #ff0000;">'&lt;br/&gt;&lt;a href=&quot;http://twitter.com/'</span> . get_the_author_meta<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'twitter'</span> <span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">'&quot;&gt;
               Follow '</span> . get_the_author<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> . <span style="color: #ff0000;">' on Twitter&lt;/a&gt;'</span>;
&nbsp;
    <span style="color: #0000ff;">$s</span> .= <span style="color: #ff0000;">'&lt;/div&gt;
&nbsp;
'</span>;
&nbsp;
    <span style="color: #0000ff;">$s</span> .= <span style="color: #ff0000;">'&lt;/div&gt;
&nbsp;
'</span>;
&nbsp;
    <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$content</span> . <span style="color: #0000ff;">$s</span>;
 <span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<h2>Want it all?</h2>
<p>The Seattle WordPress group utilizes Github to share code amongst members and for presentations. You can find this entire file on their Github page</p>
<p><a title="WordPress Seattle Github" href="https://github.com/WordPress-Seattle/PresentationSource/blob/master/Feb2012-wpseaUserProfile/wpseaUserProfile.php" onclick="return TrackClick('https%3A%2F%2Fgithub.com%2FWordPress-Seattle%2FPresentationSource%2Fblob%2Fmaster%2FFeb2012-wpseaUserProfile%2FwpseaUserProfile.php','WordPress+Seattle+Github')" onclick="return TrackClick('https%3A%2F%2Fgithub.com%2FWordPress-Seattle%2FPresentationSource%2Fblob%2Fmaster%2FFeb2012-wpseaUserProfile%2FwpseaUserProfile.php','WordPress+Seattle+Github')" target="_blank">https://github.com/WordPress-Seattle</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ben.lobaugh.net/blog/9064/wordpress-add-or-remove-user-contact-methods-in-user-profiles/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: Replace Built-in User Authentication</title>
		<link>http://ben.lobaugh.net/blog/7175/wordpress-replace-built-in-user-authentication</link>
		<comments>http://ben.lobaugh.net/blog/7175/wordpress-replace-built-in-user-authentication#comments</comments>
		<pubDate>Mon, 27 Feb 2012 23:25:23 +0000</pubDate>
		<dc:creator>blobaugh</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://ben.lobaugh.net/blog/?p=7175</guid>
		<description><![CDATA[Synopsis WordPress is a powerful multi-user web content management system. Due to its multi-user nature, WordPress has long instituted a full fledged user system, complete with separated roles and permissions for each user. What happens, however, when WordPress is brought into an environment with an existing user repository? Out of the box WordPress has no [...]]]></description>
			<content:encoded><![CDATA[<h2>Synopsis</h2>
<p>WordPress is a powerful multi-user web content management system. Due to its multi-user nature, WordPress has long instituted a full fledged user system, complete with separated roles and permissions for each user. What happens, however, when WordPress is brought into an environment with an existing user repository? Out of the box WordPress has no support for interacting with other user authentication methods other than built-in, however there exist WordPress filters that allow developers to hook into WordPress core actions, such as user authentication, registration, etc and alter their logic. In this post I will show you how to replace WordPress' built-in authentication with authentication based off a very simple web service (Which we will also create).</p>
<p>Unless otherwise noted, all development will be assumed to exist at http://localhost for the purposes of this tutorial.</p>
<h2>Now with video!</h2>
<p>Check out the following video of the presentation over this topic I gave at the March of 2012 <a title="Orange County WordPress group" href="http://ocwp.org/" onclick="return TrackClick('http%3A%2F%2Focwp.org%2F','Orange+County+WordPress+group')" target="_blank">Orange County WordPress</a> <a title="Orange County WordPress Meetup page" href="http://www.meetup.com/OC-Wordpress-Group/" onclick="return TrackClick('http%3A%2F%2Fwww.meetup.com%2FOC-Wordpress-Group%2F','Orange+County+WordPress+Meetup+page')" target="_blank">Meetup</a>. While containing lots of good information, it should be used along with the rest of this post, not as a replacement for.</p>
<div class="flowPlayer"><a class="player plain" id="postnum-7175"><embed src="http://ben.lobaugh.net/blog/wp-content/plugins/wordpress-flowplayer/flowplayer-3.0.0.swf" allowfullscreen="true" allowscriptaccess="always" quality="high" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" id="postnum-7175" bgcolor="#000000" name="postnum-7175" flashvars="config={&quot;clip&quot;:{&quot;url&quot;:&quot;http://ben.lobaugh.net/uploads/presentation_replace_wp_user_auth.flv&quot;,&quot;autoPlay&quot;:false},&quot;playerId&quot;:&quot;postnum-7175&quot;,&quot;playlist&quot;:[{&quot;url&quot;:&quot;http://ben.lobaugh.net/uploads/presentation_replace_wp_user_auth.flv&quot;,&quot;autoPlay&quot;:false}]}" width="640px" height="480px"><br />
			</a><br />
			<script language="javascript">
			("postnum-7175", "http://ben.lobaugh.net/blog/wp-content/plugins/wordpress-flowplayer/flowplayer-3.0.0.swf", {
			clip: {
				url: 'http://ben.lobaugh.net/uploads/presentation_replace_wp_user_auth.flv',
				autoPlay: false
			} 
			});
				</script></div>
<h2>Creating a simple web based authentication service</h2>
<p>We are going to create a simple web based authentication service to use as proof of concept when replacing the built-in WordPress authentication mechanism. Though this service will be simple, it will help illustrate how easy it is to authenticate using other databases, applications, even oAuth. Let's begin.</p>
<p>Create a new PHP file at http://localhost/<strong>auth_serv.php</strong> with the following contents:</p>
<pre class="php"><span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'user'</span><span style="color: #66cc66;">&#93;</span> == <span style="color: #ff0000;">'bob'</span> &amp;amp;&amp;amp; <span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'pass'</span><span style="color: #66cc66;">&#93;</span> == <span style="color: #ff0000;">'asdf'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> json_encode<span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'result'</span> =&amp;gt; <span style="color: #ff0000;">'1'</span>, <span style="color: #ff0000;">'username'</span> =&amp;gt; <span style="color: #ff0000;">'bob'</span>, <span style="color: #ff0000;">'first_name'</span> =&amp;gt; <span style="color: #ff0000;">'Bob'</span>, <span style="color: #ff0000;">'last_name'</span> =&amp;gt; <span style="color: #ff0000;">'Jacobsen'</span>, <span style="color: #ff0000;">'email'</span> =&amp;gt; <span style="color: #ff0000;">'aaben@lobaugh.net'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
    <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> json_encode<span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'result'</span> =&amp;gt; <span style="color: #ff0000;">'0'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
<p>The code simply returns a JSON encoded array. This array contains a 'result' element, which is a boolean, holding whether the user is valid or not. This service only support one user with the following credentials:</p>
<p>Username: bob<br />
Password: asdf</p>
<h2>Let's talk filters</h2>
<p>WordPress allows developers to extend and manipulate virtually all of the system through hooks. There are two types of hooks in WordPress, actions and filters. Actions allow developers to tap into the power of WordPress and create new functionality. Filters allow developers to interrupt the flow of WordPress and alter how it runs. For example, there is a filter called 'the_content'. This filter allows plugins to tap into post content before it is displayed and alter it as deemed fit.</p>
<p>For our purposes we will be using the 'authenticate' filter. Whenever a login is triggered the authenticate filter is hit and custom logic can be applied to it. The filter can be setup with the following code.</p>
<pre class="php">add_filter<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'authenticate'</span>, <span style="color: #ff0000;">'demo_auth'</span>, <span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">3</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> demo_auth<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$user</span>, <span style="color: #0000ff;">$username</span>, <span style="color: #0000ff;">$password</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$user</span>;
<span style="color: #66cc66;">&#125;</span></pre>
<p>The demo_auth function will replace the built-in authentication method. The authenticate filter sends along three parameters:</p>
<ul>
<li>$user - A WP_User object.</li>
<li>$username - From the username text box. This parameter is optional</li>
<li>$password - From the password text box. This parameter is optional</li>
</ul>
<p>Because we will be using the built-in login box to obtain a username and password to send to our pretend service we will be using the $username and $password parameter. It is important to note that the username and password parameters are not required for this filter to function properly. Why would you not need a username and password you ask? If you are using oAuth to authenticate against another provider, such as Meetup, that site will provide it's own login form to protect user information.</p>
<h2> What to keep in mind when replacing the built-in authentication</h2>
<p>WordPress relies heavily on it's built-in user system. Because of this there are lots of references to users in the WordPress database that are made. While slightly annoying, it is still fairly simple to work around these limitations.</p>
<p>WordPress requires that a real user (WordPress user) be present in the WordPress database in order to perform operations on that user. Luckily WordPress contains function to create, manipulate, and delete users. So when we build our service we will actually be taking the following steps, which should be fairly authentication type agnostic:</p>
<ul>
<li>Authenticate user via alternate method
<ul>
<li>If invalid user display invalid login message</li>
<li>If valid user
<ul>
<li>Check to see if the user exists in the WordPress user table</li>
<li>If user exists load and return user data in a WP_User object</li>
<li>If user does not exist
<ul>
<li>Automagically create a new user from alternate authentication service user information</li>
<li>After creating the user load and return user data in a WP_User object</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2>Enough blabbing, show me the code!</h2>
<p>Here is a quick dump of the code. Then I will walk through the more important pieces</p>
<pre class="php"><span style="color: #000000; font-weight: bold;">function</span> demo_auth<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$user</span>, <span style="color: #0000ff;">$username</span>, <span style="color: #0000ff;">$password</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
    <span style="color: #808080; font-style: italic;">// Make sure a username and password are present for us to work with</span>
    <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$username</span> == <span style="color: #ff0000;">''</span> || <span style="color: #0000ff;">$password</span> == <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">return</span>;
&nbsp;
    <span style="color: #0000ff;">$response</span> = wp_remote_get<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">&quot;http://localhost/auth_serv.php?user=$username&amp;amp;pass=$password&quot;</span> <span style="color: #66cc66;">&#41;</span>;
    <span style="color: #0000ff;">$ext_auth</span> = json_decode<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$response</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'body'</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
     <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$ext_auth</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'result'</span><span style="color: #66cc66;">&#93;</span>  == <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #808080; font-style: italic;">// User does not exist,  send back an error message</span>
        <span style="color: #0000ff;">$user</span> = <span style="color: #000000; font-weight: bold;">new</span> WP_Error<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'denied'</span>, __<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;&lt;strong&gt;ERROR&lt;/strong&gt;: User/pass bad&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
     <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$ext_auth</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'result'</span><span style="color: #66cc66;">&#93;</span> == <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
         <span style="color: #808080; font-style: italic;">// External user exists, try to load the user info from the WordPress user table</span>
         <span style="color: #0000ff;">$userobj</span> = <span style="color: #000000; font-weight: bold;">new</span> WP_User<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
         <span style="color: #0000ff;">$user</span> = <span style="color: #0000ff;">$userobj</span>-&amp;gt;get_data_by<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'email'</span>, <span style="color: #0000ff;">$ext_auth</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'email'</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// Does not return a WP_User object &lt;img src='http://ben.lobaugh.net/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /&gt;</span>
         <span style="color: #0000ff;">$user</span> = <span style="color: #000000; font-weight: bold;">new</span> WP_User<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$user</span>-&amp;gt;ID<span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// Attempt to load up the user with that ID</span>
&nbsp;
         <span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$user</span>-&amp;gt;ID == <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
             <span style="color: #808080; font-style: italic;">// The user does not currently exist in the WordPress user table.</span>
             <span style="color: #808080; font-style: italic;">// You have arrived at a fork in the road, choose your destiny wisely</span>
&nbsp;
             <span style="color: #808080; font-style: italic;">// If you do not want to add new users to WordPress if they do not</span>
             <span style="color: #808080; font-style: italic;">// already exist uncomment the following line and remove the user creation code</span>
             <span style="color: #808080; font-style: italic;">//$user = new WP_Error( 'denied', __(&quot;&lt;strong&gt;ERROR&lt;/strong&gt;: Not a valid user for this system&quot;) );</span>
&nbsp;
             <span style="color: #808080; font-style: italic;">// Setup the minimum required user information for this example</span>
             <span style="color: #0000ff;">$userdata</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'user_email'</span> =&amp;gt; <span style="color: #0000ff;">$ext_auth</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'email'</span><span style="color: #66cc66;">&#93;</span>,
                                <span style="color: #ff0000;">'user_login'</span> =&amp;gt; <span style="color: #0000ff;">$ext_auth</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'email'</span><span style="color: #66cc66;">&#93;</span>,
                                <span style="color: #ff0000;">'first_name'</span> =&amp;gt; <span style="color: #0000ff;">$ext_auth</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'first_name'</span><span style="color: #66cc66;">&#93;</span>,
                                <span style="color: #ff0000;">'last_name'</span> =&amp;gt; <span style="color: #0000ff;">$ext_auth</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'last_name'</span><span style="color: #66cc66;">&#93;</span>
                                <span style="color: #66cc66;">&#41;</span>;
             <span style="color: #0000ff;">$new_user_id</span> = wp_insert_user<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$userdata</span> <span style="color: #66cc66;">&#41;</span>; <span style="color: #808080; font-style: italic;">// A new user has been created</span>
&nbsp;
             <span style="color: #808080; font-style: italic;">// Load the new user info</span>
             <span style="color: #0000ff;">$user</span> = <span style="color: #000000; font-weight: bold;">new</span> WP_User <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$new_user_id</span><span style="color: #66cc66;">&#41;</span>;
         <span style="color: #66cc66;">&#125;</span> 
&nbsp;
     <span style="color: #66cc66;">&#125;</span>
&nbsp;
     <span style="color: #808080; font-style: italic;">// Comment this line if you wish to fall back on WordPress authentication</span>
     <span style="color: #808080; font-style: italic;">// Useful for times when the external service is offline</span>
     remove_action<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'authenticate'</span>, <span style="color: #ff0000;">'wp_authenticate_username_password'</span>, <span style="color: #cc66cc;">20</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
     <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$user</span>;
<span style="color: #66cc66;">&#125;</span></pre>
<p>Now let's go through some of this code:</p>
<ul>
<li><a title="WordPress Manual for wp_remote_get" href="http://codex.wordpress.org/Function_API/wp_remote_get" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org%2FFunction_API%2Fwp_remote_get','WordPress+Manual+for+wp_remote_get')" target="_blank">wp_remote_get</a>() - WordPress function that will fetch a remote resource with GET.</li>
<li><a title="WordPress Manual for WP_Error" href="http://codex.wordpress.org/Class_Reference/WP_Error" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org%2FClass_Reference%2FWP_Error','WordPress+Manual+for+WP_Error')" target="_blank">WP_Error</a> - WordPress class to handle when errors occur. The authenticate filter automagically checks WP_Error before allowing login to continue</li>
<li><a title="WordPress Manual for WP_User" href="http://codex.wordpress.org/Class_Reference/WP_User" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org%2FClass_Reference%2FWP_User','WordPress+Manual+for+WP_User')" target="_blank">WP_User</a> - The WordPress User Class allows accessing properties, roles and capabilities of a specific user.</li>
<li><a title="WordPress Manual for wp_insert_user" href="http://codex.wordpress.org/Function_Reference/wp_insert_user" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org%2FFunction_Reference%2Fwp_insert_user','WordPress+Manual+for+wp_insert_user')" target="_blank">wp_insert_user</a> - Inserts a new user into the WordPress database based on the passed in user fields</li>
</ul>
<p>The remove_action line is of particular importance. If that line exists WordPress will only authenticate based on the external service. If that line were to be commented out WordPress would fall back on the local user table for authentication if external authentication fails.</p>
<h3>Additional considerations</h3>
<p>WordPress contains several additional hooks that may be important to know about in your situation:</p>
<ul>
<li><a title="WordPress Manual for lost_password action" href="http://codex.wordpress.org/Plugin_API/Action_Reference/lost_password" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org%2FPlugin_API%2FAction_Reference%2Flost_password','WordPress+Manual+for+lost_password+action')" target="_blank">lost_password</a> - This action allows you to alter how WordPress retrieves lost passwords. If passwords may only be retrieved from the external service developers can use this hook to send users to that service to set a new password</li>
<li><a title="WordPress Manual for user_register action" href="http://codex.wordpress.org/Plugin_API/Action_Reference/user_register" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org%2FPlugin_API%2FAction_Reference%2Fuser_register','WordPress+Manual+for+user_register+action')" target="_blank">user_register</a> - Provides access to the user's data after registration. If the external authentication service allows new users to be posted to it this hook will enable developers to easily push the information out</li>
<li><a href="http://codex.wordpress.org/Plugin_API/Action_Reference/register_form" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org%2FPlugin_API%2FAction_Reference%2Fregister_form','register_form')" target="_blank">register_form</a> - Allows developers to extend the user registration form</li>
<li><a href="http://codex.wordpress.org/Plugin_API/Action_Reference/retrieve_password" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org%2FPlugin_API%2FAction_Reference%2Fretrieve_password','retrieve_password')" target="_blank">retrieve_password</a> - Helps with lost passwords</li>
<li><a href="http://codex.wordpress.org/Plugin_API/Action_Reference/password_reset" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org%2FPlugin_API%2FAction_Reference%2Fpassword_reset','password_reset')" target="_blank">password_reset</a> - Helps with lost passwords</li>
</ul>
<p>In this demo we checked to see if a user exists in WordPress based on the email supplied by the authentication provider, but what happens if that user were to change their email address on the provider's side? Suddenly they would lose all their information stored in the WordPress site, which could include access to all posts and settings. Make sure that whatever method you chose makes sense for your audience and usage patterns. Bad things happen when users think their data has been lost...</p>
<p>And more importantly, what will happen if/when the external provider goes offline? Maybe your service relies on other resources from the external provider and it is ok for your site to be down when theirs is. Generally though you will probably want your service to stay up. If this is the case then you will probably not want to have the remove_action line in the code above. Removing that line will allow WordPress to fallback on it's own user system. However, since most external authentication systems purposefully do not send back a user's password you may need to have the user reset their password on your system, or even when their user is first created have them insert an "emergency" pin to access your site when the external provider is down.</p>
<h2>Helpful links</h2>
<p>I found the following links helpful while researching this topic. If I do not make sense maybe they will</p>
<ul>
<li><a href="http://www.johnkolbert.com/wordpress/how-to-add-your-own-authentication-criteria/" onclick="return TrackClick('http%3A%2F%2Fwww.johnkolbert.com%2Fwordpress%2Fhow-to-add-your-own-authentication-criteria%2F','http%3A%2F%2Fwww.johnkolbert.com%2Fwordpress%2Fhow-to-add-your-own-authentication-criteria%2F')" target="_blank">http://www.johnkolbert.com/wordpress/how-to-add-your-own-authentication-criteria/</a></li>
<li><a href="http://www.blackbam.at/blackbams-blog/2011/06/09/wordpress-custom-external-authentication-loginlogout-php-script/" onclick="return TrackClick('http%3A%2F%2Fwww.blackbam.at%2Fblackbams-blog%2F2011%2F06%2F09%2Fwordpress-custom-external-authentication-loginlogout-php-script%2F','http%3A%2F%2Fwww.blackbam.at%2Fblackbams-blog%2F2011%2F06%2F09%2Fwordpress-custom-external-authentication-loginlogout-php-script%2F')" target="_blank">http://www.blackbam.at/blackbams-blog/2011/06/09/wordpress-custom-external-authentication-loginlogout-php-script/</a></li>
<li><a href="http://willnorris.com/2009/03/authentication-in-wordpress-28" onclick="return TrackClick('http%3A%2F%2Fwillnorris.com%2F2009%2F03%2Fauthentication-in-wordpress-28','http%3A%2F%2Fwillnorris.com%2F2009%2F03%2Fauthentication-in-wordpress-28')" target="_blank">http://willnorris.com/2009/03/authentication-in-wordpress-28</a></li>
<li><a href="http://codex.wordpress.org" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org','http%3A%2F%2Fcodex.wordpress.org')" target="_blank">http://codex.wordpress.org</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ben.lobaugh.net/blog/7175/wordpress-replace-built-in-user-authentication/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
<enclosure url="http://ben.lobaugh.net/uploads/presentation_replace_wp_user_auth.flv" length="110363455" type="video/x-flv" />
		</item>
		<item>
		<title>PHP: Strip number from string</title>
		<link>http://ben.lobaugh.net/blog/7168/php-strip-number-from-string</link>
		<comments>http://ben.lobaugh.net/blog/7168/php-strip-number-from-string#comments</comments>
		<pubDate>Sun, 12 Feb 2012 05:35:09 +0000</pubDate>
		<dc:creator>blobaugh</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://ben.lobaugh.net/blog/?p=7168</guid>
		<description><![CDATA[I recently ran across a situation where a string being used as a key contained numeric characters. The requirements specified stated that the new data structure keys do not contain numbers. This is a very simple problem to solve and can be done with a simple PHP str_replace. The following function is what I came [...]]]></description>
			<content:encoded><![CDATA[<p>I recently ran across a situation where a string being used as a key contained numeric characters. The requirements specified stated that the new data structure keys do not contain numbers. This is a very simple problem to solve and can be done with a simple PHP str_replace. The following function is what I came up with.</p>
<pre class="php">&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> trim_numbers<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$str</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #0000ff;">$n</span> = <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'0'</span>, <span style="color: #ff0000;">'1'</span>, <span style="color: #ff0000;">'2'</span>, <span style="color: #ff0000;">'3'</span>, <span style="color: #ff0000;">'4'</span>, <span style="color: #ff0000;">'5'</span>, <span style="color: #ff0000;">'6'</span>, <span style="color: #ff0000;">'7'</span>, <span style="color: #ff0000;">'8'</span>, <span style="color: #ff0000;">'9'</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #b1b100;">return</span> <a href="http://www.php.net/str_replace"><span style="color: #000066;">str_replace</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$n</span>, <span style="color: #ff0000;">''</span>, <span style="color: #0000ff;">$str</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://ben.lobaugh.net/blog/7168/php-strip-number-from-string/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL: Count number of columns in a table</title>
		<link>http://ben.lobaugh.net/blog/7155/mysql-count-number-of-columns-in-a-table</link>
		<comments>http://ben.lobaugh.net/blog/7155/mysql-count-number-of-columns-in-a-table#comments</comments>
		<pubDate>Mon, 06 Feb 2012 19:04:27 +0000</pubDate>
		<dc:creator>blobaugh</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://ben.lobaugh.net/blog/?p=7155</guid>
		<description><![CDATA[Counting the number of columns, or fields, in a MySQL table is a fairly simple, though not exactly obvious task. You will need to know both the name of the table to query on, as well as the database. The query is as follows, plug in your values for database_name and table_name &#160; SELECT COUNT&#40;*&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>Counting the number of columns, or fields, in a MySQL table is a fairly simple, though not exactly obvious task. You will need to know both the name of the table to query on, as well as the database. The query is as follows, plug in your values for database_name and table_name</p>
<pre class="sql">&nbsp;
<span style="color: #993333; font-weight: bold;">SELECT</span> COUNT<span style="color: #66cc66;">&#40;</span>*<span style="color: #66cc66;">&#41;</span>
       <span style="color: #993333; font-weight: bold;">FROM</span> INFORMATION_SCHEMA.<span style="color: #993333; font-weight: bold;">COLUMNS</span>
       <span style="color: #993333; font-weight: bold;">WHERE</span> table_schema = <span style="color: #ff0000;">'database_name'</span>
             <span style="color: #993333; font-weight: bold;">AND</span> table_name = <span style="color: #ff0000;">'tbl_name'</span>
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://ben.lobaugh.net/blog/7155/mysql-count-number-of-columns-in-a-table/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scroll Irssi in a Screen terminal from OSX</title>
		<link>http://ben.lobaugh.net/blog/7148/scroll-irssi-in-a-screen-terminal-from-osx</link>
		<comments>http://ben.lobaugh.net/blog/7148/scroll-irssi-in-a-screen-terminal-from-osx#comments</comments>
		<pubDate>Wed, 01 Feb 2012 22:00:12 +0000</pubDate>
		<dc:creator>blobaugh</dc:creator>
				<category><![CDATA[Computing Tips]]></category>

		<guid isPermaLink="false">http://ben.lobaugh.net/blog/?p=7148</guid>
		<description><![CDATA[This week I started using my Macbook again (actually picked up an Air too!) and I ran into my old scroll back issue. I use Irssi as my IRC client. In order to avoid losing conversations I run it inside a Screen session on a remote Linux server. In OSX, while using Terminal, I was [...]]]></description>
			<content:encoded><![CDATA[<p>This week I started using my Macbook again (actually picked up an Air too!) and I ran into my old scroll back issue. I use Irssi as my IRC client. In order to avoid losing conversations I run it inside a Screen session on a remote Linux server. In OSX, while using Terminal, I was unable to scroll back in the Irssi history. Well I have that problem no more! The following key combinations will allow me to scroll however I want <img src='http://ben.lobaugh.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Scroll up:<br />
Fn+Shift+Up</p>
<p>Scroll down:<br />
Fn+Shift+Down</p>
]]></content:encoded>
			<wfw:commentRss>http://ben.lobaugh.net/blog/7148/scroll-irssi-in-a-screen-terminal-from-osx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Securely Connecting to the WikiMedia Subversion Server from Windows</title>
		<link>http://ben.lobaugh.net/blog/7089/securely-connecting-to-the-wikimedia-subversion-server-from-windows</link>
		<comments>http://ben.lobaugh.net/blog/7089/securely-connecting-to-the-wikimedia-subversion-server-from-windows#comments</comments>
		<pubDate>Wed, 11 Jan 2012 17:11:49 +0000</pubDate>
		<dc:creator>blobaugh</dc:creator>
				<category><![CDATA[MediaWiki]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://ben.lobaugh.net/blog/?p=7089</guid>
		<description><![CDATA[The WikiMedia Foundation (WMF) provides public access to the MediaWiki code base via a Subversion code revisioning system. For the majority of users who just want to be on the bleeding edge of MediaWiki simply pulling from this public server will suffice, however this only allows users read access to the repository. If you want [...]]]></description>
			<content:encoded><![CDATA[<p>The WikiMedia Foundation (WMF) provides public access to the MediaWiki code base via a Subversion code revisioning system. For the majority of users who just want to be on the bleeding edge of MediaWiki simply pulling from this public server will suffice, however this only allows users read access to the repository. If you want to be a hardcore MediaWiki hacker you need to <a href="http://www.mediawiki.org/wiki/Commit_access#Requesting_commit_access" onclick="return TrackClick('http%3A%2F%2Fwww.mediawiki.org%2Fwiki%2FCommit_access%23Requesting_commit_access','request+commit+access')">request commit access</a> which will allow you to connect over the secure svn+ssh protocol and push your changes back into the core. There are a few prerequisites for gaining commits access, one of which is setting up an RSA key, which will be covered momentarily. Before we begin however, it is highly recommended that you read the entire <a href="http://www.mediawiki.org/wiki/Commit_access" onclick="return TrackClick('http%3A%2F%2Fwww.mediawiki.org%2Fwiki%2FCommit_access','Commit+Access+Guide')">Commit Access Guide</a> available on the <a href="http://www.mediawiki.org/" onclick="return TrackClick('http%3A%2F%2Fwww.mediawiki.org%2F','MediaWiki.org')">MediaWiki.org</a> site.</p>
<p><strong>NOTE:</strong> Though targeting The WMF Subversion server these instructions will be similar for all Subversion connections.</p>
<h2>Get the apps</h2>
<p>Before any work can be done two applications need to be downloaded, Putty and Tortoise SVN. These two applications will work together to connect you to the Subversion server.</p>
<p>Putty can be downloaded at: <a href="http://www.chiark.greenend.org.uk/%7Esgtatham/putty/download.html" onclick="return TrackClick('http%3A%2F%2Fwww.chiark.greenend.org.uk%2F%257Esgtatham%2Fputty%2Fdownload.html','http%3A%2F%2Fwww.chiark.greenend.org.uk%2F%7Esgtatham%2Fputty%2Fdownload.html')">http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html</a></p>
<p>Tortoise can be downloaded at: <a href="http://tortoisesvn.net/downloads.html" onclick="return TrackClick('http%3A%2F%2Ftortoisesvn.net%2Fdownloads.html','http%3A%2F%2Ftortoisesvn.net%2Fdownloads.html')">http://tortoisesvn.net/downloads.html</a></p>
<p>Run through their installation process and you will be ready to go!</p>
<h2>Generating the Key</h2>
<p>Access to the MediaWiki Subversion server requires you to first supply an SSH key to the WMF team to setup your account. Generating the key with the Putty Key Generator is quite simple with the following steps:</p>
<ul>
<li>Run <strong>puttygen</strong></li>
<li>Click on the <em>Generate</em> button and wiggle your mouse over the blank area.</li>
<li>Click <em>Save public key</em> and save it somewhere safe. For general convenience you should append “.pub” (Without quotes) to the end of the file name.<br />
<a href="http://ben.lobaugh.net/blog/wp-content/uploads/2012/01/01.png" onclick="return TrackClick('http%3A%2F%2Fben.lobaugh.net%2Fblog%2Fwp-content%2Fuploads%2F2012%2F01%2F01.png','01')"><img class="aligncenter size-full wp-image-7090" title="01" src="http://ben.lobaugh.net/blog/wp-content/uploads/2012/01/01.png" onclick="return TrackClick('http%3A%2F%2Fben.lobaugh.net%2Fblog%2Fwp-content%2Fuploads%2F2012%2F01%2F01.png','01')" alt="" width="493" height="479" /></a></li>
<li>Click <em>Save private key</em> and save it somewhere safe. This private key you will want to keep as secure as possible, as with this key a malicious user could get into your Subversion account and wreak havoc.</li>
</ul>
<h2>Setup a session in Putty</h2>
<p>Tortoise SVN uses the Putty sessions to secure the Subversion communication and manage your keys.</p>
<ul>
<li>Run <strong>putty</strong></li>
<li>Set the <em>hostname </em>of the server, input a one word <em>session</em> name, and click <strong>save<br />
<a href="http://ben.lobaugh.net/blog/wp-content/uploads/2012/01/02.png" onclick="return TrackClick('http%3A%2F%2Fben.lobaugh.net%2Fblog%2Fwp-content%2Fuploads%2F2012%2F01%2F02.png','02')"><img class="aligncenter size-full wp-image-7091" title="02" src="http://ben.lobaugh.net/blog/wp-content/uploads/2012/01/02.png" onclick="return TrackClick('http%3A%2F%2Fben.lobaugh.net%2Fblog%2Fwp-content%2Fuploads%2F2012%2F01%2F02.png','02')" alt="" width="458" height="440" /></a><br />
</strong></li>
<li>From the left menu select <em>Connections &gt; SSH &gt; Auth</em>. On this screen is a <strong>Browse </strong>button. Load the private key you create earlier here. The key should have a “.ppk” extension.<br />
<a href="http://ben.lobaugh.net/blog/wp-content/uploads/2012/01/03.png" onclick="return TrackClick('http%3A%2F%2Fben.lobaugh.net%2Fblog%2Fwp-content%2Fuploads%2F2012%2F01%2F03.png','03')"><img class="aligncenter size-full wp-image-7092" title="03" src="http://ben.lobaugh.net/blog/wp-content/uploads/2012/01/03.png" onclick="return TrackClick('http%3A%2F%2Fben.lobaugh.net%2Fblog%2Fwp-content%2Fuploads%2F2012%2F01%2F03.png','03')" alt="" width="466" height="449" /></a></li>
<li>To make sure your key will always be available go back to the <em>Session</em> page with the left menu and click <strong>Save</strong> again.</li>
</ul>
<p>Your Subversion key should now be setup and ready for use in Tortoise SVN</p>
<h2>Checkout the MediaWiki files with Tortoise SVN</h2>
<p><strong>NOTE:</strong> In this section you will pull only one copy of the MediaWiki source to work with. This is just for demonstration purposes. See “<a href="http://www.mediawiki.org/wiki/Commit_access#Getting_started_and_set_up" onclick="return TrackClick('http%3A%2F%2Fwww.mediawiki.org%2Fwiki%2FCommit_access%23Getting_started_and_set_up','Getting+started+and+set+up')">Getting started and set up</a>” for proper etiquette.</p>
<p>Tortoise SVN makes interacting with Subversion servers from Windows trivial.</p>
<ul>
<li>Create a folder to store the MediaWiki files in</li>
<li>Right click the folder and select <strong>SVN Checkout</strong></li>
<li>In the dialog box you will checkout with a URL starting with “svn+ssh://<em>username</em>@svn.wikimedia.org”. It is important to note here that “svn.wikimedia.org” DOES NOT refer to the URL of the Subversion server, but rather the session you saved in Putty previously. So if your session name was “awesomeness” you would use “svn+ssh://<em>username</em>@awesomeness”.  The rest of the URL will point to the code you desire to checkout, probably the URL svn+ssh://username@svn.wikimedia.org/svnroot/mediawiki/trunk/phase3 is what you want.<br />
<a href="http://ben.lobaugh.net/blog/wp-content/uploads/2012/01/04.png" onclick="return TrackClick('http%3A%2F%2Fben.lobaugh.net%2Fblog%2Fwp-content%2Fuploads%2F2012%2F01%2F04.png','04')"><img class="aligncenter size-full wp-image-7093" title="04" src="http://ben.lobaugh.net/blog/wp-content/uploads/2012/01/04.png" onclick="return TrackClick('http%3A%2F%2Fben.lobaugh.net%2Fblog%2Fwp-content%2Fuploads%2F2012%2F01%2F04.png','04')" alt="" width="547" height="365" /></a></li>
<li>A new dialog should pop up showing you a list of files that are being downloaded. Go make yourself some tea, this will take a while.<br />
<a href="http://ben.lobaugh.net/blog/wp-content/uploads/2012/01/05.png" onclick="return TrackClick('http%3A%2F%2Fben.lobaugh.net%2Fblog%2Fwp-content%2Fuploads%2F2012%2F01%2F05.png','05')"><img class="aligncenter size-medium wp-image-7094" title="05" src="http://ben.lobaugh.net/blog/wp-content/uploads/2012/01/05-600x290.png" alt="" width="600" height="290" /></a></li>
</ul>
<p>After the checkout completes you will have the MediaWiki code. Get hacking!</p>
<h2>Committing back to MediaWiki</h2>
<p>Tortoise SVN makes committing code changes back to the MediaWiki repository easy. The following steps will get your code flying back along the wire.</p>
<ul>
<li>Right click on the folder containing the MediaWiki checkout</li>
<li>If you have created new files they need to be added to the commit first
<ul>
<li>Hover over the <em>TortoiseSVN</em> menu item and a submenu will pop up</li>
<li>From this submenu click <strong>Add</strong></li>
<li>And new files will be show in this dialog. Choose the files you wish to include in the commit and click Ok</li>
<li>Now the really hard part, right click on the MediaWiki checkout again and click <strong>SVN Commit</strong></li>
<li>Fill in a message about your commit and look over the list of changes. When satisfied click <strong>OK</strong>.</li>
<li>A new dialog will pop up showing the files being committed and a status message after the commit finishes.</li>
</ul>
</li>
</ul>
<p>Congratulations! You have successfully committed new code to the MediaWiki Subversion repository and enriched the community. Your code will now undergo a review process and if solid will be released with the next version of MediaWiki.</p>
]]></content:encoded>
			<wfw:commentRss>http://ben.lobaugh.net/blog/7089/securely-connecting-to-the-wikimedia-subversion-server-from-windows/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My WordCamp Victoria 2012 Presentation: The Proof is in the Pudding – Yep it works with Microsoft</title>
		<link>http://ben.lobaugh.net/blog/7079/my-wordcamp-victoria-2012-presentation-the-proof-is-in-the-pudding-yep-it-works-with-microsoft</link>
		<comments>http://ben.lobaugh.net/blog/7079/my-wordcamp-victoria-2012-presentation-the-proof-is-in-the-pudding-yep-it-works-with-microsoft#comments</comments>
		<pubDate>Mon, 09 Jan 2012 03:42:38 +0000</pubDate>
		<dc:creator>blobaugh</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://ben.lobaugh.net/blog/?p=7079</guid>
		<description><![CDATA[Microsoft has been making a great effort over the years to embrace Open Source technologies and bring further support for Open Source projects to its platform. I was recruited last year by Microsoft to help further the interoperability cause and work heavily with PHP on Microsoft platforms. The platforms and tools of today have reached [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://ben.lobaugh.net/blog/wp-content/uploads/2012/01/250-speaking.png" onclick="return TrackClick('http%3A%2F%2Fben.lobaugh.net%2Fblog%2Fwp-content%2Fuploads%2F2012%2F01%2F250-speaking.png','250-speaking')"><img class="alignleft size-full wp-image-7101" style="margin-left: 10px; margin-right: 10px;" title="250-speaking" src="http://ben.lobaugh.net/blog/wp-content/uploads/2012/01/250-speaking.png" onclick="return TrackClick('http%3A%2F%2Fben.lobaugh.net%2Fblog%2Fwp-content%2Fuploads%2F2012%2F01%2F250-speaking.png','250-speaking')" alt="" width="250" height="250" /></a>Microsoft has been making a great effort over the years to embrace Open Source technologies and bring further support for Open Source projects to its platform. I was recruited last year by Microsoft to help further the interoperability cause and work heavily with PHP on Microsoft platforms. The platforms and tools of today have reached a point where running PHP and other Open Source projects in a Microsoft environment is a very viable option. This is especially great if you work at a location which primarily runs Microsoft products and does not have strong knowledge of setting up and maintaining Linux servers. During my presentation I will provide you with a "Microsoft Cookbook" of resources that will get you up and running with WordPress in a way that allows you to take advantage of everything from small shared hosting up to leveraging the amazing power of the cloud.</p>
<p>During this presentation you will learn about:</p>
<ul>
<li>Openness at Microsoft</li>
<li>End-to-end WordPress development with WebMatrix</li>
<li>How to run WordPress in the Windows Azure cloud</li>
<li>Where to find free tools from Microsoft, such as Windows Server, SQL Server, etc</li>
<li>How to manage WordPress with Windows on the go</li>
</ul>
<p>Click the title slide below to download the presentation in PDF format<br />
<a href="http://ben.lobaugh.net/blog/wp-content/uploads/2012/01/The-Proof-is-in-the-Pudding-Yep-it-works-with-Microsoft.pdf" onclick="return TrackClick('http%3A%2F%2Fben.lobaugh.net%2Fblog%2Fwp-content%2Fuploads%2F2012%2F01%2FThe-Proof-is-in-the-Pudding-Yep-it-works-with-Microsoft.pdf','title_slide_victoria_wordcamp_2012')"><img class="alignleft size-thumbnail wp-image-7103" title="title_slide_victoria_wordcamp_2012" src="http://ben.lobaugh.net/blog/wp-content/uploads/2012/01/title_slide_victoria_wordcamp_2012-150x150.png" alt="" width="150" height="150" /></a></p>
<p style="clear: both;">
<p style="clear: both;">I will be posting pictures from this WordCamp on my <a href="http://ben.lobaugh.net/gallery/main.php?g2_itemId=25811&amp;g2_fromNavId=x9c62719c" onclick="return TrackClick('http%3A%2F%2Fben.lobaugh.net%2Fgallery%2Fmain.php%3Fg2_itemId%3D25811%26amp%3Bg2_fromNavId%3Dx9c62719c','2012+Victoria+WordCamp+gallery+album')">2012 Victoria WordCamp gallery album</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ben.lobaugh.net/blog/7079/my-wordcamp-victoria-2012-presentation-the-proof-is-in-the-pudding-yep-it-works-with-microsoft/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing the Meetup API client for PHP</title>
		<link>http://ben.lobaugh.net/blog/7053/introducing-the-meetup-api-client-for-php</link>
		<comments>http://ben.lobaugh.net/blog/7053/introducing-the-meetup-api-client-for-php#comments</comments>
		<pubDate>Tue, 03 Jan 2012 02:11:59 +0000</pubDate>
		<dc:creator>blobaugh</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://ben.lobaugh.net/blog/?p=7053</guid>
		<description><![CDATA[I am working on a pretty major project right now and one of the requirements is the ability to interact with the Meetup API. I looked around and found one existing Meetup client in PHP, however it is horribly architected and as I started using it thinking I could improve it I decided it would [...]]]></description>
			<content:encoded><![CDATA[<p>I am working on a pretty major project right now and one of the requirements is the ability to interact with the <a title="Meetup" href="http://meetup.com" onclick="return TrackClick('http%3A%2F%2Fmeetup.com','Meetup')" target="_blank">Meetup </a><a title="Meetup API" href="http://www.meetup.com/meetup_api/" onclick="return TrackClick('http%3A%2F%2Fwww.meetup.com%2Fmeetup_api%2F','Meetup+API')" target="_blank">API</a>. I looked around and found one existing Meetup client in PHP, however it is horribly architected and as I started using it thinking I could improve it I decided it would be too much work and scrapped it to build my own. This new client is much more compact and efficient. The excerpt from the <a title="Meetup API client for PHP" href="https://github.com/blobaugh/Meetup-API-client-for-PHP" onclick="return TrackClick('https%3A%2F%2Fgithub.com%2Fblobaugh%2FMeetup-API-client-for-PHP','Meetup+API+client+for+PHP')" onclick="return TrackClick('https%3A%2F%2Fgithub.com%2Fblobaugh%2FMeetup-API-client-for-PHP','Meetup+API+client+for+PHP')" target="_blank">Meetup API client for PHP</a> website says:</p>
<blockquote><p>Meetup (<a href="http://meetup.com/" onclick="return TrackClick('http%3A%2F%2Fmeetup.com%2F','http%3A%2F%2Fmeetup.com')">http://meetup.com</a>) is a social networking site based around community groups. Meetup provides an API to access their platform services from remote applications to manage authentication, events, rsvps and more.</p>
<p>Until now a good PHP client for the Meetup API has not existed. This project aims to bridge that gap by providing a high quality stand alone Meetup API PHP client. This client is simple to use through provided classes and also allows powerful advanced usage through direct queries to the API</p></blockquote>
<p>The client is quite simple to setup and get running in your application quickly. Most of the GET endpoints are currently supported with plans on implmenting the rest and support for POST on the way. Check the following resources to get up and running.</p>
<ul>
<li><a title="Meetup API client for PHP" href="https://github.com/blobaugh/Meetup-API-client-for-PHP/wiki" onclick="return TrackClick('https%3A%2F%2Fgithub.com%2Fblobaugh%2FMeetup-API-client-for-PHP%2Fwiki','Meetup+API+client+for+PHP')" target="_blank">Meetup API client for PHP wiki</a></li>
<li><a title="Setup the Meetup API client for PHP" href="https://github.com/blobaugh/Meetup-API-client-for-PHP/wiki/Setup-the-client" onclick="return TrackClick('https%3A%2F%2Fgithub.com%2Fblobaugh%2FMeetup-API-client-for-PHP%2Fwiki%2FSetup-the-client','Setup+the+Meetup+API+client+for+PHP')" target="_blank">Setup the client</a></li>
<li><a title="Meetup API Documentation" href="http://www.meetup.com/meetup_api/docs/" onclick="return TrackClick('http%3A%2F%2Fwww.meetup.com%2Fmeetup_api%2Fdocs%2F','Meetup+API+Documentation')" target="_blank">Official Meetup API docs</a> - These go hand in hand with the client</li>
</ul>
<p>You can get the client from the <a title="Meetup API client for PHP" href="https://github.com/blobaugh/Meetup-API-client-for-PHP" onclick="return TrackClick('https%3A%2F%2Fgithub.com%2Fblobaugh%2FMeetup-API-client-for-PHP','Meetup+API+client+for+PHP')" onclick="return TrackClick('https%3A%2F%2Fgithub.com%2Fblobaugh%2FMeetup-API-client-for-PHP','Meetup+API+client+for+PHP')" target="_blank">Meetup API client for PHP Github project page</a></p>
<p>Please try it out and leave feedback on issues and desired additions on the <a title="Meetup API client for PHP issues page" href="https://github.com/blobaugh/Meetup-API-client-for-PHP/issues" onclick="return TrackClick('https%3A%2F%2Fgithub.com%2Fblobaugh%2FMeetup-API-client-for-PHP%2Fissues','Meetup+API+client+for+PHP+issues+page')" target="_blank">project issues page</a></p>
<p>P.S. oAuth support is currently in the works!</p>
]]></content:encoded>
			<wfw:commentRss>http://ben.lobaugh.net/blog/7053/introducing-the-meetup-api-client-for-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful sites for WordPress developers</title>
		<link>http://ben.lobaugh.net/blog/959/useful-sites-for-wordpress-developers</link>
		<comments>http://ben.lobaugh.net/blog/959/useful-sites-for-wordpress-developers#comments</comments>
		<pubDate>Wed, 02 Nov 2011 16:22:34 +0000</pubDate>
		<dc:creator>blobaugh</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://ben.lobaugh.net/blog/?p=959</guid>
		<description><![CDATA[I was asked by another WordPress developer if there are any sites that I recommend other WordPress developers follow. I do have such a list and decided that I will publish it in the hopes that others will also find these resources useful. This site of course My WordPress posts The Codex WPRecipes WordPress Tuts+ [...]]]></description>
			<content:encoded><![CDATA[<p>I was asked by another WordPress developer if there are any sites that I recommend other WordPress developers follow. I do have such a list and decided that I will publish it in the hopes that others will also find these resources useful.</p>
<ul>
<li>This site of course <img src='http://ben.lobaugh.net/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  <a title="Ben Lobaugh's WordPress posts" href="http://ben.lobaugh.net/blog/category/computing/web-development/wordpress" onclick="return TrackClick('http%3A%2F%2Fben.lobaugh.net%2Fblog%2Fcategory%2Fcomputing%2Fweb-development%2Fwordpress','Ben+Lobaugh')" target="_blank">My WordPress posts</a></li>
<li><a title="WordPress Codex" href="http://codex.wordpress.org/Main_Page" onclick="return TrackClick('http%3A%2F%2Fcodex.wordpress.org%2FMain_Page','WordPress+Codex')" target="_blank">The Codex</a></li>
<li><a title="WPRecipes.com" href="http://www.wprecipes.com/" onclick="return TrackClick('http%3A%2F%2Fwww.wprecipes.com%2F','WPRecipes.com')" target="_blank">WPRecipes</a></li>
<li><a title="WordPress Tuts+" href="http://wp.tutsplus.com/" onclick="return TrackClick('http%3A%2F%2Fwp.tutsplus.com%2F','WordPress+Tuts%2B')" target="_blank">WordPress Tuts+</a></li>
<li><a title="Pro Blog Design" href="http://www.problogdesign.com/" onclick="return TrackClick('http%3A%2F%2Fwww.problogdesign.com%2F','Pro+Blog+Design')" target="_blank">Pro Blog Design</a></li>
<li><a title="WordPress Tutorials - RSS Aggregate" href="http://www.wp-tutorials.org/" onclick="return TrackClick('http%3A%2F%2Fwww.wp-tutorials.org%2F','WordPress+Tutorials+-+RSS+Aggregate')" target="_blank">WordPress Tutorials</a> - Aggregates RSS feeds from several of the authors favorite sites</li>
<li><a title="WordPress.tv" href="http://wordpress.tv/category/how-to/" onclick="return TrackClick('http%3A%2F%2Fwordpress.tv%2Fcategory%2Fhow-to%2F','WordPress.tv')" target="_blank">WordPress.tv</a> - Official WordPress site by Automattic</li>
<li><a title="Digging into WordPress" href="http://digwp.com/" onclick="return TrackClick('http%3A%2F%2Fdigwp.com%2F','Digging+into+WordPress')" target="_blank">Digging into WordPress</a></li>
<li><a title="Smashing Magazine tagged WordPress" href="http://www.smashingmagazine.com/tag/wordpress/" onclick="return TrackClick('http%3A%2F%2Fwww.smashingmagazine.com%2Ftag%2Fwordpress%2F','Smashing+Magazine+tagged+WordPress')" target="_blank">Smashing Magazine tagged WordPress</a></li>
<li><a title="WP Engineer" href="http://wpengineer.com/" onclick="return TrackClick('http%3A%2F%2Fwpengineer.com%2F','WP+Engineer')" target="_blank">WP Engineer</a></li>
<li><a title="wpbeginner" href="http://www.wpbeginner.com/" onclick="return TrackClick('http%3A%2F%2Fwww.wpbeginner.com%2F','wpbeginner')" target="_blank">wpbeginner</a> - Excellent resource to point WordPress noobs to</li>
<li><a title="Justin Tadlock" href="http://justintadlock.com/" onclick="return TrackClick('http%3A%2F%2Fjustintadlock.com%2F','Justin+Tadlock')" target="_blank">Justin Tadlock</a> - Buy his book too!</li>
<li><a title="WP-Snippets" href="http://wp-snippets.com/" onclick="return TrackClick('http%3A%2F%2Fwp-snippets.com%2F','WP-Snippets')" target="_blank">WP-Snippets</a></li>
</ul>
<p>Someday if I get more motivated I will add fancy images and descriptions of each site <img src='http://ben.lobaugh.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://ben.lobaugh.net/blog/959/useful-sites-for-wordpress-developers/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

