<?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>Dashifen.com &#187; Wordpress</title>
	<atom:link href="http://dashifen.com/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://dashifen.com</link>
	<description>The online musings of an unrepentant geek.</description>
	<lastBuildDate>Thu, 29 Jul 2010 21:22:35 +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>Activation</title>
		<link>http://dashifen.com/activation/</link>
		<comments>http://dashifen.com/activation/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 16:59:05 +0000</pubDate>
		<dc:creator>David Dashifen Kees</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[phorum]]></category>

		<guid isPermaLink="false">http://dashifen.com/?p=75</guid>
		<description><![CDATA[I spent a while working on how I wanted to handle plugin activation for Phorum over this weekend.  I investigated using the existing WordPress tables to store the forum information but, in the end, opted to create my own custom ones for one specific reason:  it&#8217;ll be easier to clean up after myself if someone [...]]]></description>
			<content:encoded><![CDATA[<p>I spent a while working on how I wanted to handle plugin activation for Phorum over this weekend.  I investigated using the existing WordPress tables to store the forum information but, in the end, opted to create my own custom ones for one specific reason:  it&#8217;ll be easier to clean up after myself if someone uninstalls the plugin if my information isn&#8217;t strewn throughout the normal blog tables.</p>
<p>That decision made, I had to figure out the best way to handle the CREATE TABLE queries that would be required of the system when the plugin is activated (and updated).  I&#8217;ve never been a fan of the long column of SQL statements that some plugins use when creating their own tables.  I&#8217;m big stickler for code that looks pretty and is functional, so I wanted a way to store the CREATE TABLE queries in a secure fashion while also keeping them in a separate file from the main Phorum code.</p>
<p>To that end, I created a folder and in that folder I put the SQL statements.  Then, if the tables needed to be changed, I can use <a href="http://us.php.net/manual/en/function.file-get-contents.php">file_get_contents()</a> to read in the queries and then use the WordPress dbDelta() function to actually execute them.  This worked very well:</p>
<div class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$prefix</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prefix</span> <span style="color: #339933;">.</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #004000;">prefix</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$dir</span> <span style="color: #339933;">=</span> WP_PLUGIN_DIR <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/phorum/sql&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$files</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DirectoryIterator<span style="color: #009900;">&#40;</span><span style="color: #000088;">$dir</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$files</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">7</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">7</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;sql.php&quot;</span><span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #000088;">$table</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$prefix</span> <span style="color: #339933;">.</span> <span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;.sql.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$dir</span>/<span style="color: #006699; font-weight: bold;">$file</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/&lt;\?php | \?&gt;/&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #000088;">$sql</span>  <span style="color: #339933;">.=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">,</span> <span style="color: #000088;">$table</span><span style="color: #339933;">,</span> DB_CHARSET<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
dbDelta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>There&#8217;s an interesting tidbit on line 7 above.  I had to add the PHP tags around my statements to avoid them being printed on-screen if someone actually browsed to the files.  If they were simply text, then browsers would show the table information to anyone who happened by.  This way, the result is a blank screen.  It&#8217;s not yet the most elegant solution but it works for my purposes of the moment but I&#8217;ll probably keep trying to think of a better solution until one presents itself.</p>
]]></content:encoded>
			<wfw:commentRss>http://dashifen.com/activation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Phorum Begins</title>
		<link>http://dashifen.com/phorum-begins/</link>
		<comments>http://dashifen.com/phorum-begins/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 03:03:59 +0000</pubDate>
		<dc:creator>David Dashifen Kees</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[phorum]]></category>
		<category><![CDATA[plugin development]]></category>

		<guid isPermaLink="false">http://dashifen.com/?p=60</guid>
		<description><![CDATA[So, as you might have noticed, my web site suddenly became all WordPress-ified this past winter.  Since then, I&#8217;ve worked on a few other sites in WordPress, too, and in general found it to be a very positive experience.  One of those sites is the site for my World of Warcraft guild, Team Venture. One [...]]]></description>
			<content:encoded><![CDATA[<p>So, as you might have noticed, my web site suddenly became all <a href="http://wordpress.com">WordPress</a>-ified this past winter.  Since then, I&#8217;ve worked on a few other sites in WordPress, too, and in general found it to be a very positive experience.  One of those sites is the site for my <a href="http://worldofwarcraft.com">World of Warcraft</a> guild, <a href="http://teamventure.info">Team Venture</a>.</p>
<p>One of the things that I ran into on a previous site was a general lack of solid forum software for WordPress.  Sure, there&#8217;s <a href="http://bbpress.org">bbPress</a> and <a href="http://simple-press.com/">Simple:Press</a> but the former seems a little light of features and fairly difficult to theme while the latter is feature rich, but almost too much so, and equally difficult to integrate within an already existing customized appearance.</p>
<p>To that end, I&#8217;m gonna try to make my own.  Yeah, yeah; I know what you&#8217;re thinking.  Shocking that a programmer would want to try and re-create the wheel.  I recognize that it&#8217;s probably not necessarily the best use of my time to do so, but I&#8217;m treating it like a learning experience and as a way to help me blog a little bit more.</p>
<p>There&#8217;s a few other forum plugins beyond bbPress and Simple:Press, but oddly no one just went for the silly name of Phorum.  So, I&#8217;m totally going to call mine that.  I did some work on it today, but I&#8217;m going to talk about what I accomplished tomorrow in a separate post.  I just wanted to slap this one together this evening to put some thoughts into words.</p>
]]></content:encoded>
			<wfw:commentRss>http://dashifen.com/phorum-begins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ahoy, WordPress 2.8</title>
		<link>http://dashifen.com/ahoy-wordpress-2-8/</link>
		<comments>http://dashifen.com/ahoy-wordpress-2-8/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 00:21:42 +0000</pubDate>
		<dc:creator>David Dashifen Kees</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://dashifen.com/?p=10</guid>
		<description><![CDATA[I must say &#8230; as an upgrade process.  That was painless.  I, for one, welcome our new WordPress 2.8 overlords.]]></description>
			<content:encoded><![CDATA[<p>I must say &#8230; as an upgrade process.  That was painless.  I, for one, welcome our new WordPress 2.8 overlords.</p>
]]></content:encoded>
			<wfw:commentRss>http://dashifen.com/ahoy-wordpress-2-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ahoy, WordPress!</title>
		<link>http://dashifen.com/ahoy-wordpress/</link>
		<comments>http://dashifen.com/ahoy-wordpress/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 23:07:54 +0000</pubDate>
		<dc:creator>David Dashifen Kees</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://dashifen.com/?p=7</guid>
		<description><![CDATA[So, I&#8217;ve got a header and footer in WordPress matching the ones that I self-designed some time ago for the site.  I started with the Whiteboard theme from plainbeta but then pretty much threw out baby, bathwater, and bathtub before embarking on a journey of WordPress theme exploration. So far, not much to report.  In [...]]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;ve got a header and footer in WordPress matching the ones that I self-designed some time ago for the site.  I started with <a href="http://plainbeta.com/2008/05/20/whiteboard-a-free-wordpress-theme-framework/" target="_blank">the Whiteboard theme</a> from <a href="http://plainbeta.com/" target="_blank">plainbeta</a> but then pretty much threw out baby, bathwater, and bathtub before embarking on a journey of WordPress theme exploration.</p>
<p>So far, not much to report.  In fact, if you go pretty much anywhere other than the homepage, things continue to suck just a little bit, but I&#8217;ll keep working on things until I get it just the way I want it.  By then, I&#8217;ll invariably be tired of looking at this theme and I&#8217;ll want something new.</p>
]]></content:encoded>
			<wfw:commentRss>http://dashifen.com/ahoy-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
