<?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>ANDY STRATTON&#187; Development</title>
	<atom:link href="http://theandystratton.com/category/development/feed" rel="self" type="application/rss+xml" />
	<link>http://theandystratton.com</link>
	<description>WordPress and PHP Developer</description>
	<lastBuildDate>Fri, 03 Feb 2012 01:42:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Restrict WordPress Registration to Email&#160;Whitelist</title>
		<link>http://theandystratton.com/2011/restrict-wordpress-registration-to-email-whitelist</link>
		<comments>http://theandystratton.com/2011/restrict-wordpress-registration-to-email-whitelist#comments</comments>
		<pubDate>Tue, 11 Oct 2011 21:33:48 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://theandystratton.com/?p=590</guid>
		<description><![CDATA[Today I ran into a request with a client that I wanted to document and share: restricting registration to a WordPress site to a whitelist of email address domains. Luckily, there&#8217;s a sweet hook, registration_errors you can get into. It accepts 3 parameters: $errors, which is the WP_Error object; $login, which is the user_login entered [...]]]></description>
			<content:encoded><![CDATA[<p>Today I ran into a request with a client that I wanted to document and share: restricting registration to a WordPress site to a whitelist of email address domains.</p>
<p>Luckily, there&#8217;s a sweet hook, <code>registration_errors</code> you can get into. It accepts 3 parameters: <code>$errors</code>, which is the WP_Error object; <code>$login</code>, which is the <code>user_login</code> entered during registration; and <code>$email</code>, which is the <code>user_email</code> entered during registration.</p>
<p>Here&#8217;s the code:</p>
<pre><code>add_action('registration_errors', 'sizeable_restrict_domains', 10, 3);
function sizeable_restrict_domains( $errors, $login, $email ) {
	$whitelist = array('sizeableinteractive.com', 'theandystratton.com');
	if ( is_email($email) ) {
		$parts = explode('@', $email);
		$domain = $parts[count($parts)-1];
		if ( !in_array(strtolower($domain), $whitelist) ) {
			$errors->add('email_domain', __('<strong>ERROR:</strong> You may only register with an approved email address.'));
		}
	}
	return $errors;
}</code></pre>
<p><strong>Remember</strong> to specify some kind of priority AND how many parameters your callback function will accept when adding actions. I always forget to specify them when coding quickly from scratch and wonder why I&#8217;m getting weird values in my callback functions parameters.</p>
<p>Happy WP&#8217;ing.</p>
]]></content:encoded>
			<wfw:commentRss>http://theandystratton.com/2011/restrict-wordpress-registration-to-email-whitelist/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Recursively Delete Subversion (.svn)&#160;Directories</title>
		<link>http://theandystratton.com/2011/recursively-delete-subversion-svn-directories</link>
		<comments>http://theandystratton.com/2011/recursively-delete-subversion-svn-directories#comments</comments>
		<pubDate>Wed, 05 Oct 2011 18:20:14 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Terminal]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://theandystratton.com/?p=588</guid>
		<description><![CDATA[I alway am hunting for this little command-line gem, so I figured I&#8217;d post it and share the quick shell script I added to my home directory to make it faster for me to do this. Often, I will find an old project (or inherit, or destroy) a project with subversion directories and files in [...]]]></description>
			<content:encoded><![CDATA[<p>I alway am hunting for this little command-line gem, so I figured I&#8217;d post it and share the quick shell script I added to my home directory to make it faster for me to do this.</p>
<p>Often, I will find an old project (or inherit, or destroy) a project with subversion directories and files in it. However I get there, every few months I find myself wanting to remove subversion folders recursively and am not well-versed in shell scripting to remember how to do it.</p>
<p>Here&#8217;s the single line magic removal of .svn directories:</p>
<pre><cod>rm -rf `find . -type d -name .svn`</code></pre>
<p>And here&#8217;s the script I wrote and placed in my home directory, <code>~/recursively-kill-svn.sh</code>:</p>
<pre><code>while true; do
	read -p "Do you want to recursively delete all .svn folders/files in the current directory (`pwd`)? (y/n)" yn
	case $yn in

		[Yy]* ) rm -rf `find . -type d -name .svn`; echo ".svn directories in `pwd` have been recursively killed!!1"; break;;

		[Nn]* ) echo "I've done absolutely nothing."; exit;;
		* ) exit;
	esac
done</code></pre>
<p>With this in my home directory, I just move to a project folder, type:</p>
<pre><code>~/recursively-kill-svn.sh</code></pre>
<p>&#8230;and hit enter. Enjoy.</p>
<p>P.S. If it&#8217;s not working for you (or auto-completing when you hit tab in Terminal) make sure it has permissions to execute:</p>
<pre><code>chmod +x ~/recursively-kill-svn.sh</code></pre>
<p>P.P.S. You can rename the file to whatever you like.</p>
]]></content:encoded>
			<wfw:commentRss>http://theandystratton.com/2011/recursively-delete-subversion-svn-directories/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Twitter&#8217;s Search Widget Showing Too Many&#160;Tweets</title>
		<link>http://theandystratton.com/2011/twitter-search-widget-showing-too-many-tweets</link>
		<comments>http://theandystratton.com/2011/twitter-search-widget-showing-too-many-tweets#comments</comments>
		<pubDate>Tue, 31 May 2011 22:26:59 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://theandystratton.com/?p=570</guid>
		<description><![CDATA[So this is a quick post from an issue that has frustrated me. I am using and re-styling Twitter&#8217;s search widget on a client&#8217;s site. When I create it on Twitter&#8217;s widget builder, it looks great. When I paste it on the site, it&#8217;s not limiting the tweets to 5, it defaults back to 30 [...]]]></description>
			<content:encoded><![CDATA[<p>So this is a quick post from an issue that has frustrated me. I am using and re-styling <a href="http://twitter.com/about/resources/widgets/widget_search" rel="external">Twitter&#8217;s search widget</a> on a client&#8217;s site. When I create it on <a href="http://twitter.com/about/resources/widgets" rel="external">Twitter&#8217;s widget builder</a>, it looks great. When I paste it on the site, it&#8217;s not limiting the tweets to 5, it defaults back to 30 or some large number I don&#8217;t want.</p>
<p>It&#8217;s effectively missing a very simple, but critical JSON property in the root level object, named <code style="background:lightYellow;">rpp</code> (results per page, perhaps?).</p>
<h2>Example:</h2>
<pre><code>&lt;script src="http://widgets.twimg.com/j/2/widget.js"&gt;&lt;/script&gt;
&lt;script&gt;
new TWTR.Widget({
  version: 2,
  type: 'search',
  search: 'rainbow',
  interval: 6000,
  <strong style="background-color:lightYellow;">rpp: 5,</strong>
  title: 'It\'s a double rainbow',
  subject: 'Across the sky',
  width: 250,
  height: 300,
  theme: {
    shell: {
      background: '#8ec1da',
      color: '#ffffff'
    },
    tweets: {
      background: '#ffffff',
      color: '#444444',
      links: '#1985b5'
    }
  },
  features: {
    scrollbar: false,
    loop: true,
    live: true,
    hashtags: true,
    timestamp: true,
    avatars: true,
    toptweets: true,
    behavior: 'default'
  }
}).render().start();
&lt;/script&gt;</code></pre>
<p>That&#8217;s it. Just add that <code>rpp</code> property and set it to the number you want to limit by and boom!</p>
]]></content:encoded>
			<wfw:commentRss>http://theandystratton.com/2011/twitter-search-widget-showing-too-many-tweets/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Raw HTML Snippets WordPress&#160;Plugin</title>
		<link>http://theandystratton.com/2011/raw-html-snippets-wordpress-plugin</link>
		<comments>http://theandystratton.com/2011/raw-html-snippets-wordpress-plugin#comments</comments>
		<pubDate>Thu, 12 May 2011 15:16:52 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://theandystratton.com/?p=531</guid>
		<description><![CDATA[Ever since my über vent over fake shortcodes that autoformat the output of real shortcodes, I realized that the intention was good but the execution was bad. So, I wrote a quick plugin that I thought was a more elegant (and that did not affect expected, core WordPress behaviors). Raw HTML Snippets This plugin allows [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since my über vent over <a href="http://theandystratton.com/2011/shortcode-autoformatting-html-with-paragraphs-and-line-breaks">fake shortcodes that autoformat the output of real shortcodes</a>, I realized that the intention was good but the execution was bad.</p>
<p>So, I wrote a quick plugin that I thought was a more elegant (and that did not affect expected, core WordPress behaviors).</p>
<h2>Raw HTML Snippets</h2>
<p>This plugin allows you to create a library of raw HTML snippets you need to embed within post/page content, then uses the native shortcode API to embed them without them being auto-formatted by <code>wpautop</code> or <code>wptexturize</code>.</p>
<p>It may not be as convenient as pasting directly into the HTML tab of the WYSIWYG editor, but it&#8217;s a solution that&#8217;s reusable, clean and does not interfere with the core functionality of WordPress or other possible plugins/shortcodes/content filters.</p>
<p><a herf="http://wordpress.org/extend/plugins/raw-html-snippets/" rel="external">Raw HTML Snippets</a> | <a href="http://downloads.wordpress.org/plugin/raw-html-snippets.zip" rel="external">Download</a></p>
<p>Give it a whirl, and let me know what you think!</p>
]]></content:encoded>
			<wfw:commentRss>http://theandystratton.com/2011/raw-html-snippets-wordpress-plugin/feed</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Shortcode Autoformatting HTML with Paragraphs and Line&#160;Breaks</title>
		<link>http://theandystratton.com/2011/shortcode-autoformatting-html-with-paragraphs-and-line-breaks</link>
		<comments>http://theandystratton.com/2011/shortcode-autoformatting-html-with-paragraphs-and-line-breaks#comments</comments>
		<pubDate>Tue, 10 May 2011 22:41:50 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://theandystratton.com/?p=512</guid>
		<description><![CDATA[So, I have been working on a client&#8217;s WP plugin that is relatively linked to their ThemeForest WordPress theme authored by the good folks at ThemeFuse using their theme framework. Now, the easiest way to limit the reliance on the theme for the functionality I am building is to use shortcodes that output conditional content [...]]]></description>
			<content:encoded><![CDATA[<p>So, I have been working on a client&#8217;s WP plugin that is relatively linked to their <a href="http://www.themeforest.com" rel="nofollow external" title="Dear General Public: Stop customizing pre-built themes.">ThemeForest</a> WordPress theme authored by the good folks at <a href="http://www.themefuse.com" rel="external nofollow">ThemeFuse</a> using their <q>theme framework</q>.</p>
<p>Now, the easiest way to limit the reliance on the theme for the functionality I am building is to use shortcodes that output conditional content based on whether a user is logged in, based on user meta data, etc.</p>
<h2>Shortcode Autoformatting Has Helped Doubled My Time</h2>
<p>I have spent twice the amount of estimated time on this project, and at least 50% of that bloat has been this mysterious issue of my shortcode output being mysteriously auto-formatted with paragraph tags (<code>&lt;p&gt;</code>) and line-breaks (<code>&lt;br /&gt;</code>).</p>
<p>I&#8217;ve spent days ripping out the tiny hairs on my head trying to figure out why I&#8217;m such a moron when it comes to WP&#8217;s shortcode API and core content filters (things I&#8217;ve been working with for YEARS).</p>
<h2>I Do Something I Should Do More Often.</h2>
<p>My e-friend <a href="http://twitter.com/carlhancock" rel="external">Carl Hancock</a> of <a href="http://www.rocketgenius.com/" rel="external">Rocket Genius</a>, the company behind the awesomeness of functionality and user-experience that is <a href="http://www.gravityforms.com" rel="external" title="Worth Every Damn Penny + $100">GravityForms</a>, helped shed some light on this problem.</p>
<p>I figured he&#8217;d be the prefect person to reach out to, since the core of displaying a Gravity Form relies on WordPress&#8217; <a href="http://codex.wordpress.org/Shortcode_API" rel="external">Shortcode API</a>.</p>
<p>As we are direct messaging on Twitter, I remember his comments about fixing MANY ThemeForest theme issues for clients using Gravity Forms due to terrible coding standards and overriding core functionality that affect both Gravity Forms and other plugins.</p>
<p>I hunt through some of the 100+ files embedded in this pre-built theme <q>framework</q> and fine this, well, poor code:</p>
<pre><code>//Disable Automatic formatting in WordPress posts
function my_formatter($content) {
	$new_content = '';
	$pattern_full = '{(\[raw\].*?\[/raw\])}is';
	$pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
	$pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);

	foreach ($pieces as $piece) {
		if (preg_match($pattern_contents, $piece, $matches)) {
			$new_content .= $matches[1];
		} else {
			$new_content .= wptexturize(wpautop($piece));
		}
	}
	return $new_content;
}

remove_filter('the_content', 'wpautop');
remove_filter('the_content', 'wptexturize');

add_filter('the_content', 'my_formatter', 99);
</code></pre>
<p>No sooner than I see this code, I get a DM from Carl with a link to a <a href="http://www.wprecipes.com/disable-wordpress-automatic-formatting-on-posts-using-a-shortcode" rel="external">WP Recipe article</a> with the exact same code.</p>
<p>I&#8217;m not sure WHO this code started with, but I know who used it.</p>
<h2>Why is this a problem?</h2>
<p>It&#8217;s globally removing two very important core content filters that WP has built-in for very good reasons. It is typically assumed by most themes and plugins that these filters are running. I don&#8217;t have a problem turning them off conditionally (i.e. specific post ID&#8217;s, specific page templates in a theme, etc.). Better yet, set this as a setting in a custom field, <em>per page/post</em>, and have it on by default. Give me the option to disable it and even know it exists if I&#8217;m walking into the theme from a distance. </p>
<div style="width:250px;float:right;margin:0 0 1em 1em;background:#f5f5f5;border:1px solid #ccc;padding:1em;font-size:11px;font-style:italic;">At least give it the same priority as the <code>wpautop</code> and <code>wptexturize</code> filters so it does NOT affect shortcode output and behaves as similarly as possible! I realize this is to allow users to have &#8220;raw HTML output,&#8221; but you can do the same thing using it as a content filter and token replacement before/after these core filters are called.</div>
<p>This makes this theme work perfectly and negatively affects ANY and ALL plugins that have shortcodes or possibly filter content after the assumed priority of <code>wpautop</code> and <code>wptexturize</code>.</p>
<p>This is not a solution. It&#8217;s more of a hack that may or may not have cause the earthquake in Haiti, the tsunami in Japan and the tornados in the southern U.S&#8230;</p>
<h2>How the hell do I fix this?</h2>
<p><strong>Don&#8217;t use a theme that poor code in it.</strong> That&#8217;s the optimal solution. Don&#8217;t expect a $36 purchase from a virtual Wal-mart to be stable, secure or provide you with a strong solution for communicating and interacting with your clients.</p>
<h2>Okay, so realistically how do I fix this?</h2>
<ol>
<li>You can comment these lines of code out, including the <code>remove_filter()</code> calls, so that WP behaves as expected.</li>
<li>You can remove this filter in your shortcodes, which is what I did since my client is going to continue to use this theme:
<pre><code>add_shortcode('andy_shortcode', 'andy_shortcode');
function andy_shortcode( $atts, $content = '' ) {
	remove_filter('the_content', 'my_formatter', 99);
	extract(shortcode_atts(array(), $atts));
	$output = '&lt;div class="my_formatter_violated_my_output"&gt;';
	$output .= 'Thanks for using the my theme framework.&lt;/div&gt;';
	return $output;
}</code></pre>
<p>Remeber you MUST <strong>enter their priority value of 99</strong> (or whatever it is set to in your theme, chances are you&#8217;re using a theme from the same authors, or authors of the same mentality).
</li>
<li>You can stop using shortcodes or pray that it doesn&#8217;t affect you.</li>
</ol>
<h2>Final Thoughts</h2>
<p>I understand what the intention of this functionality is. In fact, I think it&#8217;s a good idea, just a poor implementation.</p>
<p>Ultimately, I&#8217;d move away from these themes and check out some stronger theme directories with dedicate WP experts coding, not a hodge-podge marketplace. Being that I&#8217;m kind of against purchasing pre-built themes from both a designer and developer standpoint, I can&#8217;t recommend a good site, but I&#8217;m sure I can keep recommending sites NOT to use.</p>
<p>Good luck and God Speed.</p>
]]></content:encoded>
			<wfw:commentRss>http://theandystratton.com/2011/shortcode-autoformatting-html-with-paragraphs-and-line-breaks/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>WordPress 3.1 Admin Bar and I Can&#8217;t See Custom&#160;Fields!</title>
		<link>http://theandystratton.com/2011/wordpress-3-1-admin-bar-and-i-cant-see-custom-fields</link>
		<comments>http://theandystratton.com/2011/wordpress-3-1-admin-bar-and-i-cant-see-custom-fields#comments</comments>
		<pubDate>Thu, 24 Feb 2011 16:42:11 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://theandystratton.com/?p=496</guid>
		<description><![CDATA[Alright WP junkies, I hope you&#8217;ve been upgrading. I won&#8217;t dive too deep into nerdiness of how the WP core team has answered my prayers and added a lot of things like better support in WP Query for taxonomy queries and Custom Fields/Meta queries, let&#8217;s focus on the Oh, Shit! moments a few of my [...]]]></description>
			<content:encoded><![CDATA[<p>Alright WP junkies, I hope you&#8217;ve been upgrading. I won&#8217;t dive too deep into nerdiness of how the WP core team has answered my prayers and added a lot of things like better support in WP Query for <a href="http://codex.wordpress.org/Function_Reference/query_posts#Taxonomy_Parameters" rel="external">taxonomy queries</a> and <a href="http://codex.wordpress.org/Function_Reference/query_posts#Custom_Field_Parameters" rel="external">Custom Fields/Meta queries</a>, let&#8217;s focus on the <q>Oh, Shit!</q> moments a few of my clients had today when I rolled some updates out.</p>
<h2>I Can&#8217;t See My Custom Fields</h2>
<p>I used custom fields a lot. Sometimes I create custom meta boxes for them, sometimes I have clients use the custom fields meta box directly. When we upgraded one of my client&#8217;s sites, my original administrator account still saw everything but the other accounts only saw the Publish, Page Attributes and title/editor panes in the Add/Edit Page screen.</p>
<p>Not cool. I was freaked. Then I realized (thanks to a <a href="http://wordpress.org/support/topic/wordpress-31-stable-cant-view-post-excerpts-or-custom-fields" rel="external">support post</a> at WordPress.org) that there are screen options there. They could&#8217;ve been there before and I just never paid attention, but now I know:</p>
<p><a target="_blank" href="http://theandystratton.com/wp-content/uploads/2011/02/Screen-shot-2011-02-24-at-11.32.40-AM.png"><img src="http://theandystratton.com/wp-content/uploads/2011/02/Screen-shot-2011-02-24-at-11.32.40-AM-300x79.png" alt="" title="Editor Screen Options" width="300" height="79" class="alignnone size-medium wp-image-500" /></a></p>
<p>Hopefully that helps you out.</p>
<h2>Killing the WordPress 3.1 Update Admin Bar</h2>
<p>Don&#8217;t get me wrong. I get it. I like it. But I have some installs where we are leveraging WP accounts but don&#8217;t want to advertise to the user that we&#8217;re on WP. I&#8217;ve used it for some very interesting applications and customized some installs heavily (not core, of course) and some clients just freaked about it.</p>
<p>My <a href="http://yoast.com/disable-wp-admin-bar/" rel="external">preferred method</a>, thanks to <a href="http://yoast.com" rel="external">Joost de Valk</a>, is to just to turn it off completely:</p>
<pre><code>add_filter('show_admin_bar', '__return_false');</code></pre>
<p>Remember, if you just want to hide it for yourself you can edit your user profile in the admin screens. <a href="http://yoast.com/disable-wp-admin-bar/" rel="external">Check out Joost&#8217;s article</a> for more options. Happy double-you-peeing.</p>
]]></content:encoded>
			<wfw:commentRss>http://theandystratton.com/2011/wordpress-3-1-admin-bar-and-i-cant-see-custom-fields/feed</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>BuddyPress Avatars Not Displaying with WordPress&#160;3.0</title>
		<link>http://theandystratton.com/2010/buddypress-avatars-not-displaying-with-wordpress-3-0</link>
		<comments>http://theandystratton.com/2010/buddypress-avatars-not-displaying-with-wordpress-3-0#comments</comments>
		<pubDate>Thu, 09 Sep 2010 15:13:26 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://theandystratton.com/?p=488</guid>
		<description><![CDATA[I don&#8217;t work with BuddyPress much if at all, but have been doing a lot more of it lately. Recently, we had an issue where avatars were not displaying on pages using the built-in template tags, like bp_member_avatar() and others. We thought this was a weird environment issue at first, but then I found this [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t work with BuddyPress much if at all, but have been doing a lot more of it lately. Recently, we had an issue where avatars were not displaying on pages using the built-in template tags, like <code>bp_member_avatar()</code> and others.</p>
<p>We thought this was a weird environment issue at first, but then I found <a href="http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/custom-avatars-not-showing-on-multisite-blogs/" rel="external">this post</a> that showed me it&#8217;s a common issue that&#8217;s been reported to their development team.</p>
<p>I continued searching for a solution and got some direction <a href="http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/custom-avatars-arent-shown-on-single-blogs-in-wpmu/" rel="external">from a solution</a> by <a href="http://buddypress.org/community/members/foralien/" rel="external">@foralien</a> on the BuddyPress forums. Her solution did not work for, but I created my own version and had success.</p>
<h2>What was happening?</h2>
<p>Our BuddyPress installation was trying to get avatars from <code>/blogs.dir/1/files/avatars/{$user_id}/{$filename}</code> – which did not eve exist, this was referencing a files directory for the root blog and it didn&#8217;t even exist.</p>
<p>As per <a href="http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/custom-avatars-arent-shown-on-single-blogs-in-wpmu/" rel="external">@foralien&#8217;s solution</a>, I created 2 filters (one for the avatar path, the other for the avatar public URL):</p>
<p><a href="/downloads/bp-avatar-filters.txt"><strong>Download the Code</strong></a></p>
<pre class="brush: php; title: ; notranslate">// Custom filters to clean up issues in WP 3.0 with avatar paths.
// Written by @theandystratton
function sizeable_bp_core_avatar_folder_dir( $path ) {
	$items = explode('/', $path);
	$path = ABSPATH . 'wp-content/uploads/avatars/' . end($items);
	return $path;
}
add_filter('bp_core_avatar_folder_dir', 'sizeable_bp_core_avatar_folder_dir');
function sizeable_bp_core_avatar_folder_url( $url ) {
	$items = explode('/', $url);
	$url = 'http://' . $items[2] . '/wp-content/uploads/avatars/' . end($items);
	return $url;
}
add_filter('bp_core_avatar_folder_url', 'sizeable_bp_core_avatar_folder_url');</pre>
<h2>What it&#8217;s doing</h2>
<p>We&#8217;re filtering the path and the url for avatars to ensure it&#8217;s using the WP 3.0 location, which is the upload_path for the root site followed by <code>/avatars/{$user_id}</code>. This is <em>not</em> a forever fix. I&#8217;d use it as duct tape until they release a BuddyPress update for WP 3.0 fixing the issue.</p>
<p>Hope this helps you guys and saves you some time and frustration.</p>
]]></content:encoded>
			<wfw:commentRss>http://theandystratton.com/2010/buddypress-avatars-not-displaying-with-wordpress-3-0/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>10 Things Web Development Taught Me About&#160;Life</title>
		<link>http://theandystratton.com/2010/10-things-web-development-taught-me-about-life</link>
		<comments>http://theandystratton.com/2010/10-things-web-development-taught-me-about-life#comments</comments>
		<pubDate>Sat, 07 Aug 2010 05:33:25 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://theandystratton.com/?p=465</guid>
		<description><![CDATA[Or How I Learned To Stop Worrying And Love Being a Human 1. Plan Your Work, Work Your Plan. In any project, it works best to put pen to paper and create a plan of action. In programming, we tend to call these algorithms. They take shape as lists, flow charts and diagrams. I do [...]]]></description>
			<content:encoded><![CDATA[<h2 style="font-size:1.5em;color:#888;">Or How I Learned To Stop Worrying And Love Being a Human</h2>
<h3>1. Plan Your Work, Work Your Plan.</h3>
<p>In any project, it works best to put pen to paper and create a plan of action. In programming, we tend to call these algorithms. They take shape as lists, flow charts and diagrams. I do them all the time. They fit into our patterns of daily life quite well. It&#8217;s all about making the right decisions, implementing them is the easy part.</p>
<p>Organization and foresight can save you in both web development and life. (<em>Though, there&#8217;s something to be said for spontaneity.</em>)</p>
<h3>2. There Are An Infinite Number of Solutions To Every Problem.</h3>
<p>It&#8217;s true. There are a million different ways to do something. In web programming, the metric for appropriateness is the client needs, the hosting environment and project budget/scope. In life, it tends to be your environmental context, i.e. social, economic, political, etc. All in all, there&#8217;s no 100% definitive right way to do something, what a pleasure it&#8217;s been to accept that truth!</p>
<h3>3. Shortcuts Have a Time and a Place.</h3>
<p>That epic battle of quality versus quantity. Everyone wants both, whether they are a client or someone in your personal life. There&#8217;s a time and a place for libraries of code, pre-existing applications and templates. Ideally, you want to craft your own path, but sometimes you just don&#8217;t have the budget. That budget could be a project&#8217;s financial budget, it could be a timeline or it could be your mental or physical energy.</p>
<p>I&#8217;ve found that context is a key indicator in whether or not I should be using a shortcut in my web (and personal) development.</p>
<h3>4. Nothing Ever Goes 100% As You Planned.</h3>
<p>It&#8217;s hard to meet 100% of people&#8217;s expectations. Expectations, even if clearly defined, can still be subjective. Everyone has an image of how they want a project to go, and it&#8217;s rarely exactly as they envisioned. The same with life. Perfection is a myth and there&#8217;s perfection in imperfection. It&#8217;s a great thing, and it&#8217;s very relieving to understand that fact and appreciate the moments you have.</p>
<h3>5. Specialization is Key.</h3>
<p>This is about focus. Remember the old design adage: <q>if everything is important, nothing is important.</q> It&#8217;s true. A jack of all trades is an expert in none. Same with life. Keeping your focus on the things that are most important to you will make you successful. For some it&#8217;s family, others it&#8217;s career and status, and for some: it&#8217;s others. The best advice is to find out what you want to specialize in and become an expert. Success is bound to follow.</p>
<h3>6. Exercise Is Important!</h3>
<p>Practice makes perfect. Exercise your skills and you&#8217;ll get better, polished and more refined. The same with your body and mind. The computer is my tool for work, my body and mind are my tools for life. Never stop learning and growing. It keeps you fresh and focused (<em>see #5</em>). Exercising your body will also help your energy levels, concentration and keep you healthy.</p>
<h3>7. Nothing Gets Done Until You Do It.</h3>
<p>In my industry, we tend to talk a lot about process. What would be great/fun/cool/exciting. But nothing ever happens until we start building the application. Same goes for life. You can talk all you want about what you want to do with yourself, but it&#8217;s never going to happen until you take action.</p>
<h3>8. There&#8217;s Always Someone Better Than You (At Least In Your Mind).</h3>
<p>I think I&#8217;m a good programmer. I&#8217;ve gotten compliments from mentors and people I respect/admire in my industry&hellip;then I see some other great professionals&#8217; work and I think, <em>I suck</em>. Not the case! There is always someone better than you at what you&#8217;re doing, and if you&#8217;re the best, odds are you don&#8217;t know it. That&#8217;s the nature of hard workers.</p>
<p>It&#8217;s important to remember that and avoid becoming stressed out or consumed by what others are doing. That&#8217;s just unnecessary distraction. Focus on you and be the best version of yourself – and OWN it. Good things will follow. No one ever stood out by following the crowd anyway.</p>
<h3>9. You&#8217;ll Never Be Disappointed You Did Something Right the First Time.</h3>
<p>So, you&#8217;re building a form that accepts payment information. You&#8217;re only checking to make sure fields aren&#8217;t empty. 1,000 spam submissions hit and plague your clients inbox because you didn&#8217;t validate an email address or require a CAPTCHA. Ouch.</p>
<p>If you had took the time in the first place to build it right, this wouldn&#8217;t be an issue. You&#8217;d be playing some kind of stereotypical gaming console drinking Red Bull or whatever drink the typical web developer is drinking now-a-days and your client would be happy and probably referring you to others.</p>
<p>There&#8217;s a classic honorability in doing something right the first time. Same with life. I&#8217;ve taken far too many shortcuts when I shouldn&#8217;t have in life, and in most cases it&#8217;s cause me grief. I have <strong>never</strong> regretted taking the long road to do something right.</p>
<h3>10. There&#8217;s No Substitute For Fresh Air and Sunshine On Your Face.</h3>
<p>Get out of the house, get away from the screen and breath some fresh air. You need it. You&#8217;re body, mind and soul will thank you. You&#8217;ll come back with a fresh perspective.</p>
<p>My career is based on machines, and I&#8217;ll be the first to admit that human beings weren&#8217;t meant to sit in front of them all day. Think of me as the blogging, freelancing <a href="http://en.wikipedia.org/wiki/Office_Space" rel="external">Peter Gibbons</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://theandystratton.com/2010/10-things-web-development-taught-me-about-life/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Shared Hosting Fix&#8230; Uhm,&#160;fix.</title>
		<link>http://theandystratton.com/2010/shared-hosting-fix-uhm-fix</link>
		<comments>http://theandystratton.com/2010/shared-hosting-fix-uhm-fix#comments</comments>
		<pubDate>Wed, 30 Jun 2010 02:47:30 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://theandystratton.com/?p=434</guid>
		<description><![CDATA[So I&#8217;ve had some reports that the shared hosting hack fix that I wrote as a quick bridge to a real solution left some people with PHP documents that contained a bit of leading whitespace, which can really b0rk up your WordPress install or any PHP application if it&#8217;s in the right file the wrong [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve had some reports that the <a href="http://theandystratton.com/2010/shared-godaddy-hosting-wordpress-malware-hack-fix">shared hosting hack fix</a> that I wrote as a quick bridge to a <a href="http://theandystratton.com/2010/shared-godaddy-hosting-wordpress-malware-hack-fix#do-more">real solution</a> left some people with PHP documents that contained a bit of leading whitespace, which can really b0rk up your WordPress install or any PHP application if it&#8217;s in the right file the wrong way.</p>
<p>So, I give you the cleaner (special thanks to Michael Safovich for requesting and testing).</p>
<h3>What&#8217;s it do</h3>
<p>It recursively looks through it&#8217;s current directory (and subdirectories) for PHP files (by default it&#8217;s looking for <code>php</code>, <code>php4</code>, <code>php5</code> and <code>phtml</code> extensions, but this is customizable) and killing any whitespace in the beginning of the file, turning:</p>
<pre><code>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
&lt;?php include_once './wp-blog-header.php'; ?&gt;</code></pre>
<p>into this:</p>
<pre><code>&lt;?php include_once './wp-blog-header.php'; ?&gt;</code></pre>
<p>Make sense? Good, here&#8217;s the <a href="/downloads/cleaner.zip">download link</a>.</p>
<h3>Tips &amp; Customization</h3>
<p>BACK UP YOUR FILES. You agree to take responsibility for running this, because I sure don&#8217;t (though I think you&#8217;ll be fine).</p>
<p>To run on custom file types, edit the <code>$fileTypes</code> array to include the types you want to strip leading whitespace from.</p>
<p>The script will run for the current directory. You will need to set the <code>$directory</code> variable to contain the path you&#8217;d like to recursively clean, in most cases you&#8217;d drop the <code>cleaner.php</code> file in your document root and hit it in the browser.</p>
<p>It will run immediately and output a log. Hope it helps. ¡Hasta luego!</p>
]]></content:encoded>
			<wfw:commentRss>http://theandystratton.com/2010/shared-hosting-fix-uhm-fix/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Postfix/sendmail broken on OS X since installing&#160;FiOS</title>
		<link>http://theandystratton.com/2010/postfix-sendmail-broken-on-os-x-since-installing-fios</link>
		<comments>http://theandystratton.com/2010/postfix-sendmail-broken-on-os-x-since-installing-fios#comments</comments>
		<pubDate>Wed, 23 Jun 2010 05:06:06 +0000</pubDate>
		<dc:creator>andy</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://theandystratton.com/?p=428</guid>
		<description><![CDATA[So, I&#8217;ve had issues before with my jury rigged Macports-powered MAMP setup. The biggest time suck has been postfix/sendmail issues, like I experience for 2&#8211;3 hours today. The Problem(s) Sending mail from PHP&#8217;s mail() function and SwiftMailer both seemed to be sending things correctly (returning true and such) No emails were being received by any [...]]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;ve had <a href="http://theandystratton.com/2009/fix-phps-mail-function-after-latest-os-x-leopard-update">issues before</a> with my jury rigged <a href="http://www.macports.org" rel="nofollow external">Macports</a>-powered <abbr title="Macintosh Apache MySQL PHP">MAMP</abbr> setup. The biggest time suck has been postfix/sendmail issues, like I experience for 2&ndash;3 hours today.</p>
<h2>The Problem(s)</h2>
<ul>
<li>Sending mail from PHP&#8217;s <code>mail()</code> function and <a href="http://swiftmailer.org/" rel="nofollow external">SwiftMailer</a> both seemed to be sending things correctly (returning <code>true</code> and such)</li>
<li>No emails were being received by any of my email addresses</li>
<li><code>postfix</code> was running</li>
<li>I kept getting an <q>operation has timed out</q> in the error log when trying to connect to SMTP servers (try: <code>tail -f /var/log/mail.log</code> to see it real time)</li>
<li>I couldn&#8217;t even <code>telnet ASPMX.L.GOOGLE.COM 25</code></li>
</ul>
<p><strong>What the EFF, right?</strong></p>
<p>Then I start thinking. I can&#8217;t get out on port 25, maybe it&#8217;s the router. After resetting the password and all settings (I&#8217;m a moron, I forgot the user/pass I setup), and re-configuring everything (I use a custom subnet at home to let me VPN special places), I found no option for this in the FiOS Actiontec router admin software.</p>
<h2>FiOS is Blocking Port 25</h2>
<p>Yep. That had to be it. I called their support line and confirmed it. My residential account had port 25 blocked and according to a few message boards, business accounts with dedicated IP&#8217;s were being blocked as well.</p>
<p>How&#8217;d I get around it? I found <a href="http://www.wormly.com/blog/2008/11/05/relay-gmail-google-smtp-postfix/" rel="external">this article</a> on <a href="http://www.wormly.com/blog/2008/11/05/relay-gmail-google-smtp-postfix/" rel="external">relaying mail through Google SMTP with postfix on Snow Leopard</a> and it saved my life.</p>
<p>I don&#8217;t have a lot of time to describe everything, but just follow <a href="http://www.wormly.com/blog/2008/11/05/relay-gmail-google-smtp-postfix/" rel="external">life-saving article</a> </p>
<p><strong>Thanks, <a href="http://www.wormly.com/blog/">Jules</a>.</strong> You literally saved me hundreds to even thousands of dollars in time/energy.</p>
<p>Now everyone, say thanks to Jules&hellip;</p>
]]></content:encoded>
			<wfw:commentRss>http://theandystratton.com/2010/postfix-sendmail-broken-on-os-x-since-installing-fios/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

