<?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>Grey Hats &#187; Programming</title>
	<atom:link href="http://www.greyhats.com/category/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://www.greyhats.com</link>
	<description>Home of Borked Cast, also a place for Nerds, Geeks</description>
	<lastBuildDate>Sat, 31 Jul 2010 18:22:21 +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>A better way to host multiple domains on WordPress MU/Multi-Site</title>
		<link>http://www.greyhats.com/programming/a-better-way-to-host-multiple-domains-on-wordpress-wpmu-multi-site-558</link>
		<comments>http://www.greyhats.com/programming/a-better-way-to-host-multiple-domains-on-wordpress-wpmu-multi-site-558#comments</comments>
		<pubDate>Thu, 29 Jul 2010 23:42:06 +0000</pubDate>
		<dc:creator>revoked</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[multi domains]]></category>
		<category><![CDATA[multisite]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wpmu]]></category>

		<guid isPermaLink="false">http://www.greyhats.com/?p=558</guid>
		<description><![CDATA[What am I talking about!? Well, there is this thing called &#8220;Multi-Site&#8221; in WordPress 3.0. You can read official docs on it here: Create a Network. It used to be called WordPress Mu or WPMU. The Multi-Site platform is MEANT to allow you to host multiple blogs on one domain via either subdirectories or subdomains [...]]]></description>
			<content:encoded><![CDATA[<!-- wp-jquery-lightbox, a WordPress plugin by ulfben --> <p><strong>What am I talking about!?</strong></p>
<p>Well, there is this thing called &#8220;Multi-Site&#8221; in WordPress 3.0. You can read official docs on it here: <a href="http://codex.wordpress.org/Create_A_Network" target="_blank">Create a Network</a>. It used to be called WordPress Mu or WPMU. The Multi-Site platform is MEANT to allow you to host multiple blogs on one domain via either subdirectories or subdomains like:</p>
<blockquote><p>http://www.somesite.com/joesblog</p>
<p><em>or</em></p>
<p>http://joesblog.somesite.com</p></blockquote>
<p>But any savvy web dev knows that this is not far from being able to host say the following on the same WordPress Multi-Site platform/install:</p>
<blockquote><p>http://joesblog.com</p>
<p><em>and</em></p>
<p>http://samsblog.com</p></blockquote>
<p>That&#8217;s what this guide is for: to help you &#8220;hack&#8221; WordPress to get multi-domains to work. Now you can do this with some fancy redirection plugins. But I really don&#8217;t like these because they mask/redirect a subdomain which can complicate some plugins and who knows what else. That&#8217;s why I wrote this post so you can make this work without using a redirection plugin.</p>
<p><strong>This is really only for smarty-pants web developers</strong></p>
<p>It&#8217;s possible that one day WordPress will move/remove this code I&#8217;m modifying. They did it in 2.9 -&gt; 3.0 and I had to go looking for that bit of code again. Sure I&#8217;ll probably update this post if they do, but for how long? As long as I&#8217;m managing a Multi-Site I suppose. You do the math. So that said, you&#8217;re probably going to want to be smart enough to debug this if I quit the internets, or you don&#8217;t bookmark my site, or monsters eat your homework, etc..</p>
<p>Additionally: I haven&#8217;t ran this by ANY wordpress experts. But I&#8217;ve been running this on &#8220;old&#8221; WPMU for years, and now &#8220;new&#8221; 3.0 Multi-Site, with no issues.</p>
<p><strong>This is NOT for the faint of heart!</strong></p>
<p>If you have a lot of sites you&#8217;re going to want to gauge heavily on how/when to do this. However in my opinion this is a LOT less janky than all the redirect plugins. Twice I reviewed my options and both times I came up using this method. Once it&#8217;s done: it&#8217;s great.</p>
<p><strong>This is also the first draft.</strong></p>
<p>I literally copy/pasted this from an email I just sent and made some modifications, so it may by a little rough. I&#8217;ll try to update it if people give me feedback or I do any modifications on my end.</p>
<p><strong>My method is two-part</strong></p>
<ol>
<li>changing 1 line of php (into 2)</li>
<li>changing the &#8220;domain name&#8221; in the db for each blog to be the real domain instead of the subdomain</li>
</ol>
<p><strong>Part 1</strong></p>
<p><em> note some further info/instruction can be found here on updating to new WP versions etc.: <a href="http://codex.wordpress.org/Installing/Updating_WordPress_with_Subversion" target="_blank">Installing/Updating WordPress with Subversion</a></em></p>
<p>We check out via svn on the 3.0.1 tag (note: this is the latest version as of this posting):<br />
<code><br />
$ svn co http://core.svn.wordpress.org/tags/3.0.1 .<br />
</code><br />
<em> note: don&#8217;t worry about not being able to updated to new versions like 3.1 etc all you have to do to do so is: svn switch http://core.svn.wordpress.org/tags/3.1 you can see how to do that in that wp codex article I linked</em></p>
<p>once we&#8217;re checked out, we are able to make changes to the core and be able to still update from wordpress because updating from the remote repository will trigger a merge with our locally modified code. So we don&#8217;t have to fear our slight modification ever getting overwritten.</p>
<p>As for the code we changed, it&#8217;s very simple. WPMU is (obviously) only setup to work on subdomains and subdirectories. So it _always_ loads the basic info from the root domain name. So we only need to make a slight modification for when it does this:</p>
<p>Here is the .diff patch if you don&#8217;t want to do it manually: <a href="http://www.greyhats.com/wp-content/ds_wpmu.zip">ds_wpmu.zip</a></p>
<p><a></a></p>
<p>file: wp-includes/ms-load.php<br />
line: ~141</p>
<p>remove this line:<br />
<code><br />
$current_site-&gt;blog_id = $wpdb-&gt;get_var( $wpdb-&gt;prepare( "SELECT blog_id FROM $wpdb-&gt;blogs WHERE domain = %s AND path = %s", $current_site-&gt;domain, $current_site-&gt;path ) );<br />
</code><br />
replace with these lines:<br />
<code><br />
$current_site-&gt;blog_id = $wpdb-&gt;get_var( $wpdb-&gt;prepare( "SELECT blog_id FROM $wpdb-&gt;blogs WHERE domain = %s AND path = %s", $domain, $path ) );<br />
$current_site-&gt;domain = $domain;<br />
</code></p>
<p><strong>Part 2</strong></p>
<p>Then you have to update each blog so that it&#8217;s domain name isn&#8217;t the subdomain and instead is the real domain. When I first set this up I had &lt; 20 domain so I did it all manually, you may want to do it automagically if you already have a lot of sites via a big sql script or a mixed php/sql script or w/e your favorites are. Anyway these are the options that need to be updated in each blog:</p>
<ol>
<li>in [wp_blogs] each [domain] field (and possibly [path] if you&#8217;re using subdirectories)</li>
<li>in each [wp_X_options] table, X being the blog&#8217;s ID the following fields:</li>
</ol>
<ul>
<li>siteurl</li>
<li>home</li>
<li>fileupload_url</li>
</ul>
<p><em> Note: Instead you can update the domain manually in wp-admin when editing the site. You can check-box the &#8220;Update siteurl and home as well.&#8221; but it doesn&#8217;t update fileupload_url, so make sure to change tht too.</em></p>
<p>And that&#8217;s it.</p>
<p>Naturally these instructions come with no warranty, so don&#8217;t break your stuff, and make sure to back everything up before you do anything. I&#8217;m sure some of you are looking at me in horror, but meh, get over it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.greyhats.com/programming/a-better-way-to-host-multiple-domains-on-wordpress-wpmu-multi-site-558/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Thank you Adobe AIR Team!</title>
		<link>http://www.greyhats.com/programming/thank-you-adobe-air-team-105</link>
		<comments>http://www.greyhats.com/programming/thank-you-adobe-air-team-105#comments</comments>
		<pubDate>Fri, 01 Aug 2008 20:37:27 +0000</pubDate>
		<dc:creator>revoked</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[air]]></category>

		<guid isPermaLink="false">http://www.greyhats.com/2008/08/01/thank-you-adobe-air-team/</guid>
		<description><![CDATA[The Adobe AIR Team had a quick post up the other day offering a free pocket reference guide to the first few emails. I managed to wrangle one and it just showed up! Thanks Adobe!]]></description>
			<content:encoded><![CDATA[<!-- wp-jquery-lightbox, a WordPress plugin by ulfben --> <p>The Adobe AIR Team had a quick post up the other day offering a free pocket reference guide to the first few emails. I managed to wrangle one and it just showed up! Thanks Adobe!</p>
<p><a href="http://www.greyhats.com/wp-content/uploads/p-640-480-ae144b49-91f8-41a2-9e86-dc2e65ad4104.jpeg" rel="lightbox[105]"><img class="alignnone size-full wp-image-364" src="http://www.greyhats.com/wp-content/uploads/p-640-480-ae144b49-91f8-41a2-9e86-dc2e65ad4104.jpeg" alt="photo" width="225" height="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.greyhats.com/programming/thank-you-adobe-air-team-105/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Maps + IE8 Beta 1 = Epic Fail</title>
		<link>http://www.greyhats.com/tech/ie8-beta1-google-maps-epic-fail-71</link>
		<comments>http://www.greyhats.com/tech/ie8-beta1-google-maps-epic-fail-71#comments</comments>
		<pubDate>Thu, 06 Mar 2008 00:49:39 +0000</pubDate>
		<dc:creator>revoked</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.greyhats.com/2008/03/05/ie8-beta1-google-maps-epic-fail/</guid>
		<description><![CDATA[The front-end engineers certainly have their work cut out for them with the release if IE8 on the horizon. Albeit that this IS a Beta, and the FIRST of all public Betas, but still, all my sites generally mostly work (except those using google maps).]]></description>
			<content:encoded><![CDATA[<!-- wp-jquery-lightbox, a WordPress plugin by ulfben --> <p>The front-end engineers certainly have their work cut out for them with the release if IE8 on the horizon. Albeit that this IS a Beta, and the FIRST of all public Betas, but still, all my sites <strike>generally</strike> mostly work (except those using google maps).</p>
<p><strong>Remember folks, this is <em>early</em> beta software, rendering (most likely) browser specific <strike>hacks</strike> styling, so take this with a grain of salt.</strong></p>
<p><a href="http://www.greyhats.com/wp-content/uploads/googlemaps-epicfail.png" rel="lightbox[71]"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" border="0" alt="GoogleMaps-Epicfail" src="http://www.greyhats.com/wp-content/uploads/googlemaps-epicfail-thumb.png" width="487" height="403" /></a></p>
<p>And embedded</p>
<p><a href="http://www.greyhats.com/wp-content/uploads/googlemaps2-epicfail.png" rel="lightbox[71]"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" border="0" alt="GoogleMaps2-EpicFail" src="http://www.greyhats.com/wp-content/uploads/googlemaps2-epicfail-thumb.png" width="487" height="397" /></a></p>
<p>But wait! Not even Microsoft&#8217;s DOM based maps look good:</p>
<p><a href="http://www.greyhats.com/wp-content/uploads/livemaps-epicfail.png" rel="lightbox[71]"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" border="0" alt="LiveMaps-EpicFail" src="http://www.greyhats.com/wp-content/uploads/livemaps-epicfail-thumb.png" width="487" height="429" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.greyhats.com/tech/ie8-beta1-google-maps-epic-fail-71/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Safari 3 &#8230; wtf?</title>
		<link>http://www.greyhats.com/programming/safari-3-wtf-52</link>
		<comments>http://www.greyhats.com/programming/safari-3-wtf-52#comments</comments>
		<pubDate>Tue, 27 Nov 2007 20:02:25 +0000</pubDate>
		<dc:creator>revoked</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.greyhats.com/2007/11/27/safari-3-wtf/</guid>
		<description><![CDATA[So far my experience with Safari 3 (on win32) has been a very good one. By far it is the fastest Javascript implementation I&#8217;ve ever seen. On top of that it&#8217;s compatibility is very very close to FireFox 2. We&#8217;ve seen only a few issues, specifically in regards to Flash implementations. But I&#8217;m not here [...]]]></description>
			<content:encoded><![CDATA[<!-- wp-jquery-lightbox, a WordPress plugin by ulfben --> <p>So far <strong>my experience with <a href="http://www.apple.com/safari/" target="_blank">Safari 3</a> (on win32) has been a very good one</strong>. By far it is the fastest Javascript implementation I&#8217;ve ever seen. On top of that it&#8217;s compatibility is very very close to FireFox 2. We&#8217;ve seen only a few issues, specifically in regards to Flash implementations.</p>
<p>But I&#8217;m not here to talk about what apple has done right with safari. <strong>I&#8217;m here to talk about what they did wrong</strong>, specifically the only thing that I can find that they did wrong. Lets take a look at a few screenshots of their very nice ui:</p>
<p>The Address Bar:</p>
<p><img id="id" title="pretty blue glow" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="84" alt="pretty blue glow" src="http://www.greyhats.com/wp-content/uploads/addressbar.png" width="269" border="0" /> </p>
<p>The Pretty Buttons:</p>
<p><img id="id" title="glassy even" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="101" alt="glassy even" src="http://www.greyhats.com/wp-content/uploads/buttons1.png" width="237" border="0" /> </p>
<p>The Sweet RSS and Google-Search:</p>
<p><img id="id" title="i&#x27;m feeling lucky" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="100" alt="i&#x27;m feeling lucky" src="http://www.greyhats.com/wp-content/uploads/rssgooglesearch.png" width="257" border="0" /> </p>
<p>But&#8230; what happened <strong><em>HERE!?</em></strong></p>
<p><img id="id" title="lego-corners" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="91" alt="lego-corners" src="http://www.greyhats.com/wp-content/uploads/corner1.png" width="105" border="0" /> </p>
<p>Apple&#8230; anti-aliasing! Please!</p>
<p><img id="id" title="am I playing police quest?!" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="104" alt="am I playing police quest?!" src="http://www.greyhats.com/wp-content/uploads/cornergross.png" width="104" border="0" /> </p>
<p><strong>GAH!</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.greyhats.com/programming/safari-3-wtf-52/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>oh my little rgb to hex function</title>
		<link>http://www.greyhats.com/programming/oh-my-little-rgb-function-41</link>
		<comments>http://www.greyhats.com/programming/oh-my-little-rgb-function-41#comments</comments>
		<pubDate>Wed, 30 May 2007 17:25:12 +0000</pubDate>
		<dc:creator>revoked</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Snippet]]></category>

		<guid isPermaLink="false">http://www.greyhats.com/2007/05/30/oh-my-little-rgb-function/</guid>
		<description><![CDATA[how I love you function rgb(r,g,b){ return r.toString(16) + g.toString(16) + b.toString(16); }]]></description>
			<content:encoded><![CDATA[<!-- wp-jquery-lightbox, a WordPress plugin by ulfben --> <p>how I love you</p>
<p><code>function rgb(r,g,b){<br />
	return r.toString(16) + g.toString(16) + b.toString(16);<br />
}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.greyhats.com/programming/oh-my-little-rgb-function-41/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
