<?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>The Life of Lew Ayotte &#187; development</title>
	<atom:link href="http://lewayotte.com/tag/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://lewayotte.com</link>
	<description>Pursue righteousness, godliness, faith, love, perseverance and gentleness. Fight the good fight of faith; take hold of the eternal life to which you were called... - 1 Timothy 6:11-12</description>
	<lastBuildDate>Wed, 09 May 2012 16:30:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Remove Username Character Limit from WordPress Multi-Site / Multi-User</title>
		<link>http://lewayotte.com/2010/05/13/remove-username-character-limit-from-wordpress-multi-site-multi-user/</link>
		<comments>http://lewayotte.com/2010/05/13/remove-username-character-limit-from-wordpress-multi-site-multi-user/#comments</comments>
		<pubDate>Thu, 13 May 2010 16:30:37 +0000</pubDate>
		<dc:creator>Lew</dc:creator>
				<category><![CDATA[Mind]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[mu-plugins]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wpms]]></category>
		<category><![CDATA[wpmu]]></category>

		<guid isPermaLink="false">http://lewayotte.com/?p=1672</guid>
		<description><![CDATA[I&#8217;ve been working on a pretty complex project with WordPress MultiUser (soon to be MultiSite). This client needs several sites with hundreds of users divided into each site. I will be integrating the backend authentication with LDAP and discovered that a small percentage of their users have usernames with fewer than four characters. WordPress MU [...]<div class="addthis_toolbox addthis_default_style addthis_" addthis:url='http://lewayotte.com/2010/05/13/remove-username-character-limit-from-wordpress-multi-site-multi-user/' addthis:title='Remove Username Character Limit from WordPress Multi-Site / Multi-User ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a pretty complex project with WordPress MultiUser (soon to be MultiSite). This client needs several sites with hundreds of users divided into each site. I will be integrating the backend authentication with LDAP and discovered that a small percentage of their users have usernames with fewer than four characters.</p>
<p>WordPress MU currently has a minimum limit of four characters set in its core. Unfortunately, this limit is still imposed in WordPress MS 3.0. The limit is probably there because usernames were used for the domain too and WP-Devs didn&#8217;t want to conflict with country codes. But that is not an issue for my client, so I wanted to kill the limit (without touching core).</p>
<p>Basically, I wrote a quick mu-plugin that unset the error message when someone tries to add a user with fewer than four characters. Doing this removes any halts that would stop processing the new user. Here is my code:</p>
<pre name="code" class="php">function remove_username_char_limit($result) {
  if ( is_wp_error( $result[ 'errors' ] ) &#038;&#038; !empty( $result[ 'errors' ]->errors ) ) {

    // Get all the error messages from $result
    $messages = $result['errors']->get_error_messages();
    $i = 0;
    foreach ( $messages as $message ) {

      // Check if any message is the char limit message
      if ( 0 == strcasecmp("Username must be at least 4 characters", $message)) {
        // Unset whole 'user_name' error array if only 1 message exists
        // and that message is the char limit error
        if ( 1 == count($messages) ) {
          unset( $result['errors']->errors['user_name'] );
        } else {
          // Otherwise just unset the char limit message
          unset( $result['errors']->errors['user_name'][$i] );
        }
      }	

      $i++;
    }
  }

  return $result;
}
add_action('wpmu_validate_user_signup', 'remove_username_char_limit');</pre>
<div class="addthis_toolbox addthis_default_style addthis_" addthis:url='http://lewayotte.com/2010/05/13/remove-username-character-limit-from-wordpress-multi-site-multi-user/' addthis:title='Remove Username Character Limit from WordPress Multi-Site / Multi-User ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://lewayotte.com/2010/05/13/remove-username-character-limit-from-wordpress-multi-site-multi-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easily Extended Contact Info in WordPress</title>
		<link>http://lewayotte.com/2010/04/22/easily-extended-contact-info-in-wordpress/</link>
		<comments>http://lewayotte.com/2010/04/22/easily-extended-contact-info-in-wordpress/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 20:50:54 +0000</pubDate>
		<dc:creator>Lew</dc:creator>
				<category><![CDATA[Mind]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://lewayotte.com/?p=1668</guid>
		<description><![CDATA[I&#8217;m working on a project where I need the ability to add &#8220;Phone&#8221;, &#8220;Building&#8221;, and &#8220;Room&#8221; as information a user could add in their profile. I also wanted to remove &#8220;AIM&#8221;, &#8220;Yahoo&#8221;, and &#8220;Jabber&#8221; &#8212; none of the users are going to need to fill in that info. You can easily add this code into [...]<div class="addthis_toolbox addthis_default_style addthis_" addthis:url='http://lewayotte.com/2010/04/22/easily-extended-contact-info-in-wordpress/' addthis:title='Easily Extended Contact Info in WordPress ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a project where I need the ability to add &#8220;Phone&#8221;, &#8220;Building&#8221;, and &#8220;Room&#8221; as information a user could add in their profile. I also wanted to remove &#8220;AIM&#8221;, &#8220;Yahoo&#8221;, and &#8220;Jabber&#8221; &#8212; none of the users are going to need to fill in that info.</p>
<p>You can easily add this code into your functions.php. I was writing it for a WordPress MU site with multiple themes and needed to make sure it was enforced, so I stuck it in the mu-plugins directory, in a file named &#8220;extended-contact-info.php&#8221;.</p>
<p>This is the simple code block you need:</p>
<pre name="code" class="php">
function extended_contact_info($user_contactmethods) {
	//Use this if you want to append to the default
	//contact methods (AIM, Yahoo, Jabber)
	//$user_contactmethods += array(
	//	'building' => __('Building'),
	//	'room' => __('Room'),
	//	'phone' => __('Phone')
	//);

	//Use this if you want to ignore the default
	//contact methods (AIM, Yahoo, Jabber)
	$user_contactmethods = array(
		'building' => __('Building'),
		'room' => __('Room'),
		'phone' => __('Phone')
	);

	return $user_contactmethods;
}

add_filter('user_contactmethods', 'extended_contact_info');
</pre>
<div class="addthis_toolbox addthis_default_style addthis_" addthis:url='http://lewayotte.com/2010/04/22/easily-extended-contact-info-in-wordpress/' addthis:title='Easily Extended Contact Info in WordPress ' ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>]]></content:encoded>
			<wfw:commentRss>http://lewayotte.com/2010/04/22/easily-extended-contact-info-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

