<?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>Out to Lunch Productions &#187; PHP</title>
	<atom:link href="http://www.outtolunchproductions.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.outtolunchproductions.com</link>
	<description>Silly name. Serious websites.</description>
	<lastBuildDate>Mon, 02 Jan 2012 19:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>VoterPool</title>
		<link>http://www.outtolunchproductions.com/voterpool/</link>
		<comments>http://www.outtolunchproductions.com/voterpool/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 01:39:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Work]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.outtolunchproductions.com/?p=455</guid>
		<description><![CDATA[<p><strong>Creative Brief:</strong> Design and develop an easy-to-use web app that can help people arrange carpools to go vote. This solves a number of problems:</p>
<ul>
<li><strong>Motivation.</strong><br />
You&#8217;re more likely to do something if you know someone is counting on you.</li></ul><p>&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p><strong>Creative Brief:</strong> Design and develop an easy-to-use web app that can help people arrange carpools to go vote. This solves a number of problems:</p>
<ul>
<li><strong>Motivation.</strong><br />
You&#8217;re more likely to do something if you know someone is counting on you.</li>
<li><strong>Feeling good.</strong><br />
You&#8217;re volunteering by doing something that you wanted to do anyway (drive to the polls).</li>
<li><strong>Connecting.</strong><br />
Coming together with new people, however brief and for what ever reason, is an opportunity we can ill afford to miss these days. This is especially true when it facilitates a common civic purpose, like helping people cast their ballots.</li>
</ul>
<p>To help sort out the complexity of this project, I&#8217;ve broken it down into the major parts: The signup form,the poll locator/Google Map,  the messaging system and the user matcher.</p>
<h2>The Signup Form</h2>
<p>As with all my projects, jQuery plays the lead role. I wanted an AJAX form on the front page for people to sign up, and I couldn&#8217;t think of any way to make all the requisite text boxes look good. Using jQuery, I was easily able to split them up into a slider that would only allow users to progress to the next step once they&#8217;ve completed the necessary bits.</p>
<p>We wanted to make the signup process as simple as possible so anyone could do it, so we only asked for information that was absolutely necessary;</p>
<ul>
<li>Rider or Driver</li>
<li>Where you vote</li>
<li>Display name</li>
<li>Email</li>
<li>Password</li>
</ul>
<div id="attachment_459" class="wp-caption aligncenter" style="width: 310px"><img class="size-full wp-image-459 " title="VoterPool login form" src="http://www.outtolunchproductions.com/wp-content/uploads/2009/10/vp-shot1.png" alt="VoterPool login form" width="300" height="255" /><p class="wp-caption-text">User-friendly signup</p></div>
<p>I didn&#8217;t want to take on the task of developing a user management system from scratch, so I decided to build the site in WordPress. By using the Register Plus plugin, I was able to create a login page that asked for all the necessary information. I then took that form and created the jQuery scrolling signup form for the front page.</p>
<p>Using simple hide() and fadeIn() commands, I was able to prevent users from moving ahead too quickly in the form. They couldn&#8217;t click the &#8220;Next&#8221; button until they had successfully completed the part of the form they were looking at. This proved to be essential for the poll locator, which I&#8217;ll talk about in a moment.</p>
<p>Aside from their status as a rider or a driver, the most important piece of information we needed was the street address of the polling place of each individual user. This brings me to&#8230;</p>
<h2>The Poll Locator</h2>
<p>The League of Women Voters built a database of polling places that is searchable by mailing address. They call it Vote411.Org, and without VoterPool couldn&#8217;t function.</p>
<p>Because we wanted to match people by their polling places, we couldn&#8217;t use something as broad as a ZIP code. Densely populated urban areas like New York City and Los Angeles simply have too many polling places for a system like that to be useful. So, I needed to create a solution that could take a variety of input styles (all uppercase, no capitalization, whatever) and create uniform outputs of polling place addresses.</p>
<p>By combining AJAX with a customized PHP cURL script and the Vote411.Org database, I found our answer. More importantly, if no address comes back from Vote411, the &#8220;Next&#8221; button won&#8217;t appear, meaning that particular user can&#8217;t continue. It&#8217;s a very effective way of preventing people from signing up with the wrong polling place address.</p>
<h2>Searchable Google Map</h2>
<div id="attachment_460" class="wp-caption aligncenter" style="width: 310px"><img class="size-full wp-image-460 " title="VoterPool searchable google map" src="http://www.outtolunchproductions.com/wp-content/uploads/2009/10/vp-shot2.png" alt="VoterPool searchable google map" width="300" height="259" /><p class="wp-caption-text">Searchable Google Map</p></div>
<p>I had to search for quite a while before I found the answer to this, but by using a MySQL query to print out their polling place&#8217;s street address and the Google Maps API, I was able to add a searchable Google map that starts centered on their specific polling place to each user&#8217;s page.</p>
<p>It was important that they be able to search the area near their polling place so they could easily find good, public pickup spots. Remember, these were going to be perfect strangers arranging carpools, and people usually behave better when they know someone is watching. Also, Google provides a good set of route planning tools.</p>
<h2>The Messaging System</h2>
<p>Next to the cURL script that finds the polling place street address, the thing I&#8217;m most proud of creating for this project is the custom messaging system.</p>
<p>A big gap in the user functionality that WordPress provides is the ability to message other users. There are a few plugins out there that do it, but none of them allow for front-end access to the messaging system. I didn&#8217;t want users mucking around in the WordPress back-end, so I decided to write my own.</p>
<p>I want to take a moment and state that this, this right here, is why I love open-source scripting languages. If the thing you want doesn&#8217;t exist, just make it yourself.</p>
<p>The first thing I did was create a MySQL table specifically for messages. Every message contains its own ID, the user ID of the sender, the user ID of the receiver, and the message itself. By cross-referencing the user IDs that WordPress assigns each user, each display name is matched with the appropriate user.</p>
<p>To get the most out of using WordPress, I decided to look into the wp_mail() function. Turns out, you can do quite a bit with it. The most obvious is email alerts to new messages. But, by allowing users to assign phone numbers to their accounts, they can receive text messages to their cell-phones by using the email-to-text function that most carriers provide.</p>
<h2>The User Matcher</h2>
<p>This actually turned out to be the simplest part of the entire process. Once I had normalized the street addresses that came back from Vote411.Org, it was a simple MySQL query to print out a list of users that matched the same address. Then, running that list through a filter (so drivers only see riders and riders only see drivers) was the last step.</p>
<h2>Moving past a beta</h2>
<p>VoterPool is up and running, but I won&#8217;t know how successful it can be until people start trying to use it. Most of the feedback has been either positive or helpful, which is exactly what someone like me hopes for. What I&#8217;m looking forward to learning about next are things like server load, cycles and RAM.</p>
<p>Yes. Weird things excite me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.outtolunchproductions.com/voterpool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

