<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>ElasticDog.com</title>
	
	<link>http://elasticdog.com</link>
	<description>Imagine Something Clever</description>
	<pubDate>Mon, 02 Jun 2008 01:07:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/elasticdog" type="application/rss+xml" /><item>
		<title>Comments Missing in WordPress Dashboard After 2.5.1 Upgrade</title>
		<link>http://feeds.feedburner.com/~r/elasticdog/~3/278005008/</link>
		<comments>http://elasticdog.com/2008/04/comments-missing-in-wordpress-dashboard-after-251-upgrade/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 02:22:13 +0000</pubDate>
		<dc:creator>Aaron Schaefer</dc:creator>
		
		<category><![CDATA[WordPress]]></category>

		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://elasticdog.com/?p=28</guid>
		<description><![CDATA[I just upgraded the WordPress installation for ElasticDog to version 2.5.1 and noticed that the Manage Comments page in the administrative Dashboard was not displaying any comments.  I only noticed there was a problem when the interface kept telling me there were 9 comments awaiting moderation, yet it would not let me see them. [...]]]></description>
			<content:encoded><![CDATA[<p>I just upgraded the WordPress installation for ElasticDog to version 2.5.1 and noticed that the Manage Comments page in the administrative Dashboard was not displaying any comments.  I only noticed there was a problem when the interface kept telling me there were 9 comments awaiting moderation, yet <a href="http://elasticdog.com/images/2008/04/awaiting-moderation.png">it would not let me see them</a>.  Everything was displaying correctly on the publicly viewable blog pages, but no comments showed up when trying to access them via the Dashboard.</p>
<p>After searching for a bit and checking my sever logs, I found that the upgrade script did not add the proper index to the &#8220;comment_date_gmt&#8221; column in the comments table for my WordPress database:</p>
<pre><code>Apr 25 18:22:17 php-cgi: WordPress database error Key 'comment_date_gmt' doesn't exist in table 'wp_comment' for query...</code></pre>
<p></p>
<h3 id="solution">The Solution</h3>
<p>If you don&#8217;t want to wait until the upgrade script gets fixed in a later WordPress release, you&#8217;ll have to add the missing index to the database table yourself to get things working again.  I&#8217;ll demonstrate how to do that using the MySQL command line interface, however, if you&#8217;re more comfortable with using phpMyAdmin, see <a href="http://wordpress.org/support/topic/167450#post-737217">the steps outlined here</a>.</p>
<h4 id="privileges">Check for Proper Privileges</h4>
<p>First of all, you must have the proper privileges on your WordPress database in order to add an index.  To check that, follow these steps:</p>
<ol>
<li>Log in to MySQL with whatever account credentials you know.
<pre><code>$ <strong>mysql -u root -p</strong>
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 59202
Server version: 5.0.51a Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql&gt;</code></pre>
</li>
<li>Specify that you want to access the &#8220;mysql&#8221; database, then ensure that you do have the privileges to add indexes.
<pre><code>mysql&gt; <strong>use mysql</strong>
Database changed
mysql&gt; <strong>SELECT user, index_priv FROM user;</strong>
+------------+------------+
| user       | index_priv |
+------------+------------+
| root       | Y          |
| elasticdog | N          |
+------------+------------+
2 rows in set (0.00 sec)</code></pre>
</li>
</ol>
<p>As long as you see a &#8216;Y&#8217; next to your username, then you should be good to go.</p>
<h4 id="cli">Add the Index to the Comments Table</h4>
<p>Once you have access to an account that can add indexes, then follow these steps to add the missing index:</p>
<ol>
<li>Specify that you want to access your WordPress database.  If you don&#8217;t know the name of your WordPress database, run <code>show databases;</code> to see a list of databases you have access to.
<pre><code>mysql&gt; <strong>use elasticdog_wordpress</strong>
Database changed</code></pre>
</li>
<li>Add the index.  The table names for WordPress are fairly standard, but if you don&#8217;t have one named &#8220;wp_comments&#8221;, run <code>show tables;</code> to see a list of contenders and it should be easy to figure out.
<pre><code>mysql&gt; <strong>CREATE INDEX comment_date_gmt ON wp_comments (comment_date_gmt);</strong>
Query OK, 458 rows affected (0.14 sec)
Records: 458  Duplicates: 0  Warnings: 0</code></pre>
</li>
<li>If want to verify that the index was created, run <br /><code>SHOW INDEX FROM wp_comments;</code> to list all indexes, and then you can exit out.</li>
</ol>
<p>If everything went as planned, all will be right in the world and your comments should be viewable through the dashboard once again!</p>
---<br />Related Posts at ElasticDog:<ul><li><a href="http://elasticdog.com/2004/10/faking-multiple-templates/" rel="bookmark" title="October 7th, 2004">Faking Multiple Templates in WordPress</a></li>

<li><a href="http://elasticdog.com/2004/11/wp-design-sandbox/" rel="bookmark" title="November 10th, 2004">WordPress Design Sandbox</a></li>

<li><a href="http://elasticdog.com/2008/02/current-status-of-the-code-viewer-wordpress-plugin/" rel="bookmark" title="February 23rd, 2008">Current Status of the Code Viewer WordPress Plugin</a></li>

<li><a href="http://elasticdog.com/2008/02/howto-install-wordpress-on-nginx/" rel="bookmark" title="February 27th, 2008">HOWTO: Install WordPress on Nginx</a></li>
</ul><!-- Similar Posts took 6.730 ms --><img src="http://feeds.feedburner.com/~r/elasticdog/~4/278005008" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://elasticdog.com/2008/04/comments-missing-in-wordpress-dashboard-after-251-upgrade/feed/</wfw:commentRss>
		<feedburner:origLink>http://elasticdog.com/2008/04/comments-missing-in-wordpress-dashboard-after-251-upgrade/</feedburner:origLink></item>
		<item>
		<title>HOWTO: Install WordPress on Nginx</title>
		<link>http://feeds.feedburner.com/~r/elasticdog/~3/241944953/</link>
		<comments>http://elasticdog.com/2008/02/howto-install-wordpress-on-nginx/#comments</comments>
		<pubDate>Wed, 27 Feb 2008 07:15:31 +0000</pubDate>
		<dc:creator>Aaron Schaefer</dc:creator>
		
		<category><![CDATA[WordPress]]></category>

		<category><![CDATA[Nginx]]></category>

		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://elasticdog.com/2008/02/howto-install-wordpress-on-nginx/</guid>
		<description><![CDATA[So you want to install the files for <a href="http://wordpress.org/">WordPress</a> in a subdirectory while running your blog in the root directory?  If your server is running <a href="http://httpd.apache.org/">Apache</a>, then <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">it's pretty straight forward</a> to do.  Trouble is, what if you want to run a web server that's a little faster and lighter on resources, like <a href="http://nginx.net/">Nginx</a>?  Here's how to do it...]]></description>
			<content:encoded><![CDATA[<p>I recently moved all of my sites from a cheap shared host to a shiny new <abbr title="Virtual Private Server">VPS</abbr> at <a href="http://www.slicehost.com/">SliceHost</a>, and couldn&#8217;t be happier.  Running your own VPS means a great amount of flexibility since you have full root access to the server and get to configure everything exactly how you want it.  That said, it also means that if you want to maintain high performance, you have to keep your resource usage to a minimum.</p>
<p><a href="http://httpd.apache.org/">Apache</a> is a very well-establish web server that can handle just about any situation.  Unfortunately, that flexibility comes at the cost of size and relatively high demands on server resources.  <a href="http://nginx.net/">Nginx</a> (&#8220;engine x&#8221;) is a lightweight web server/reverse proxy that is very efficient and perfect for hosting WordPress.  Read on to see how that can be done&#8230;</p>
<h3 id="step-one">Step One: FastCGI</h3>
<p>First off, Nginx does not provide FastCGI for you (FastCGI is what your web server uses to interact with WordPress&#8217;s <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> code), so you&#8217;ve got to have a way to spawn your own FastCGI processes.  My preferred method is to use the <code>spawn-fcgi</code> program provided by the web server <a href="http://www.lighttpd.net/">lighttpd</a>. You <em>can</em> use PHP&#8217;s built-in FastCGI manager <code>php-cgi</code> to <a href="http://blog.kovyrin.net/2006/05/30/nginx-php-fastcgi-howto/">do the same thing</a>, but it&#8217;s not as straight-forward. Plus, if you learn how to use <code>spawn-fcgi</code>, you can easily adapt it for use with other web applications requiring FastCGI.</p>
<h4>Install spawn-fcgi</h4>
<p>To download and install <code>spawn-fcgi</code>, run the following commands.  Don&#8217;t worry, all of the building happens in your current directory&#8230;nothing else will be installed on your machine.</p>
<pre><code>$ wget http://www.lighttpd.net/download/lighttpd-1.4.18.tar.bz2
$ tar -xvjf lighttpd-1.4.18.tar.bz2
$ cd lighttpd-1.4.18/
$ ./configure
$ make
$ sudo cp src/spawn-fcgi /usr/bin/spawn-fcgi</code></pre>
<p></p>
<p><i>NOTE: If you&#8217;re following the steps above verbatim, you will need to have root privileges in order to copy the binary to its final location&#8230;everything else should work fine as a normal user. To gain root privileges, the program <code>sudo</code> was used in the example above; you may or may not have access to <code>sudo</code> on your machine.</i></p>
<p>After <code>spawn-fcgi</code> has been copied to the desired location, you can safely remove the build directory and original source file:</p>
<pre><code>$ cd ..
$ rm -rf lighttpd-1.4.18/
$ rm lighttpd-1.4.18.tar.bz2</code></pre>
<p></p>
<h4>Run spawn-fcgi</h4>
<p>This part will be fairly distribution-specific, but I&#8217;ll provide the basic command that you&#8217;ll need. What you want to do is find a way to run this command as part of your init scripts so the processes will be spawned automatically when you reboot your server.</p>
<pre><code>/usr/bin/spawn-fcgi -f /usr/bin/php-cgi -a 127.0.0.1 -p 53217 -P /var/run/fastcgi-php.pid</code></pre>
<p></p>
<ul>
<li><code>-f</code> &rarr; the filename of the fcgi-application; in our case we want &#8220;php-cgi&#8221;, which is provided by your distribution&#8217;s <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> package. If you don&#8217;t know where to find it, try running <code>which php-cgi</code> on the command line.</li>
<li><code>-a</code> &rarr; the IP address to bind the processes to; in our case we want the localhost</li>
<li><code>-p</code> &rarr; the port number to bind the processes to; pick whatever you want that won&#8217;t cause a conflict (technically it would be best to pick a random number between 49152 and 65535), just make sure to remember the number and use that same port for your Nginx configuration file later on</li>
<li><code>-P</code> &rarr; the location where to save the process id file; you can use this file to easily kill the processes later</li>
</ul>
<p>For better security, you can also spawn the processes as a non-privileged user by specifying the user/group with the <code>-u</code> and <code>-g</code> flags respectively. For more information on all the available options, run <code>spawn-fcgi -h</code> on the command line. </p>
<p>If you&#8217;re interested in seeing the complete init script that I wrote for use with <a href="http://www.archlinux.org/">Arch Linux</a>, you can download it here: <a href="http://elasticdog.com/code/2008/02/fastcgi-php">fastcgi-php</a></p>
<h3 id="step-two">Step Two: Complete 83.33% of the Famous 5-Minute Install</h3>
<p>Next you should download the WordPress files and extract them to their final location on your server.  Simply follow steps 1&#8211;5 of the <a href="http://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install">Famous 5-Minute Install</a> (the 6th and final step requires that your web server be up and running properly, so we&#8217;ll do it later).  This guide will assume that you extracted the WordPress core files here: <code>/srv/www/nginx/domain.com/</code></p>
<h3 id="step-three">Step Three: Nginx Configuration</h3>
<p>To get the web server up and running properly, the file you need to edit is called &#8220;nginx.conf&#8221; and is installed in different places depending on your Linux distribution. If you install Nginx from source, the default location is <code>/usr/local/nginx/conf/nginx.conf</code>, however yours may be somewhere else.</p>
<p>Once you find that file, open it with your favorite text editor and add a server declaration that looks something like this (I&#8217;ll cover what each part means after posting the code):</p>
<pre><code>server {
    listen       <em>12.34.56.78</em>:80;  <strong># your server's public IP address</strong>
    server_name  <em>domain.com</em>;      <strong># your domain name</strong>

    location / {
        root   <em>/srv/www/nginx/domain.com</em>;  <strong># absolute path to your WordPress installation</strong>
        index  index.php index.html index.htm;

        # this serves static files that exist without running other rewrite tests
        if (-f $request_filename) {
            expires 30d;
            break;
        }

        # this sends all non-existing file or directory requests to index.php
        if (!-e $request_filename) {
            rewrite ^(.+)$ /index.php?q=$1 last;
        }
    }

    location ~ \.php$ {
        fastcgi_pass   localhost:<em>53217</em>;  <strong># port where FastCGI processes were spawned</strong>
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME    <em>/srv/www/nginx/domain.com</em>$fastcgi_script_name;  <strong># same path as above</strong>

        fastcgi_param  QUERY_STRING       $query_string;
        fastcgi_param  REQUEST_METHOD     $request_method;
        fastcgi_param  CONTENT_TYPE       $content_type;
        fastcgi_param  CONTENT_LENGTH     $content_length;

        fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
        fastcgi_param  REQUEST_URI        $request_uri;
        fastcgi_param  DOCUMENT_URI       $document_uri;
        fastcgi_param  DOCUMENT_ROOT      $document_root;
        fastcgi_param  SERVER_PROTOCOL    $server_protocol;

        fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
        fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

        fastcgi_param  REMOTE_ADDR        $remote_addr;
        fastcgi_param  REMOTE_PORT        $remote_port;
        fastcgi_param  SERVER_ADDR        $server_addr;
        fastcgi_param  SERVER_PORT        $server_port;
        fastcgi_param  SERVER_NAME        $server_name;

        # required if PHP was built with --enable-force-cgi-redirect
        fastcgi_param  REDIRECT_STATUS    200;
    }
}</code></pre>
<div class="sourcelink">Download Source Code: <a href="http://elasticdog.com/code/2008/02/nginx-conf.txt">nginx-conf.txt</a></div>
<p></p>
<p>You will need to edit all of the highlighted sections above using your own information.  The first part is merely the server declaration where you define what your server&#8217;s publicly available IP address is and what domain name that address is associated with.</p>
<p>Next we add to that some default settings for the root location.  The key part here is that WordPress uses the &#8220;Front Controller&#8221; design pattern, meaning that any request for a file that does not exist on the server should be handled by the main index.php file.  To do this, we need an appropriate set of rewrite rules pointing to the proper path of our installation.</p>
<p>Last, we add one more location block that tells Nginx to dynamically forward <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> requests to the FastCGI processes we <a href="#step-one">spawned earlier</a>.  That&#8217;s it!</p>
<h3 id="step-four">Step Four: Finishing Up</h3>
<p>Everything should be good to go&#8230;all you need to do now is start your Nginx server process (another distribution specific command), then complete the 6th step of the <a href="http://codex.wordpress.org/Installing_WordPress#Famous_5-Minute_Install">Famous 5-Minute Install</a> and you should have WordPress up and running on Nginx!</p>
<p>If any of this needs further clarification or you&#8217;re just having trouble, leave me a comment and I&#8217;ll see what I can do to help&#8230;</p>
---<br />Related Posts at ElasticDog:<ul><li><a href="http://elasticdog.com/2004/10/faking-multiple-templates/" rel="bookmark" title="October 7th, 2004">Faking Multiple Templates in WordPress</a></li>

<li><a href="http://elasticdog.com/2004/11/wp-design-sandbox/" rel="bookmark" title="November 10th, 2004">WordPress Design Sandbox</a></li>

<li><a href="http://elasticdog.com/2008/02/optimal-title-functionality-now-in-wordpress-core/" rel="bookmark" title="February 20th, 2008">Optimal Title Functionality Now in WordPress Core</a></li>

<li><a href="http://elasticdog.com/2008/04/comments-missing-in-wordpress-dashboard-after-251-upgrade/" rel="bookmark" title="April 25th, 2008">Comments Missing in WordPress Dashboard After 2.5.1 Upgrade</a></li>
</ul><!-- Similar Posts took 8.278 ms --><img src="http://feeds.feedburner.com/~r/elasticdog/~4/241944953" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://elasticdog.com/2008/02/howto-install-wordpress-on-nginx/feed/</wfw:commentRss>
		<feedburner:origLink>http://elasticdog.com/2008/02/howto-install-wordpress-on-nginx/</feedburner:origLink></item>
		<item>
		<title>Current Status of the Code Viewer WordPress Plugin</title>
		<link>http://feeds.feedburner.com/~r/elasticdog/~3/240182935/</link>
		<comments>http://elasticdog.com/2008/02/current-status-of-the-code-viewer-wordpress-plugin/#comments</comments>
		<pubDate>Sun, 24 Feb 2008 02:56:42 +0000</pubDate>
		<dc:creator>Aaron Schaefer</dc:creator>
		
		<category><![CDATA[WordPress]]></category>

		<category><![CDATA[Plugin]]></category>

		<guid isPermaLink="false">http://elasticdog.com/2008/02/current-status-of-the-code-viewer-wordpress-plugin/</guid>
		<description><![CDATA[This site has been neglected for a long time, and that negligence has carried over to the development of the Code Viewer WordPress plugin as well.  While I&#8217;ve been away, Code Viewer has been picked up/enhanced by a few other developers &#8212; namely AJ and Håkan Carlström &#8212; and has gained many new features&#8230;
Code [...]]]></description>
			<content:encoded><![CDATA[<p>This site has been neglected for a long time, and that negligence has carried over to the development of the <a href="http://elasticdog.com/2004/09/code-viewer/">Code Viewer</a> WordPress plugin as well.  While I&#8217;ve been away, Code Viewer has been picked up/enhanced by a few other developers &#8212; namely <a href="http://flash.terra.ee/">AJ</a> and <a href="http://www.familjencarlstrom.se/WordPress/">Håkan Carlström</a> &#8212; and has gained many new features&#8230;</p>
<p>Code Viewer now supports syntax highlighting using <a href="http://qbnz.com/highlighter/">GeSHi</a>, can display specific line numbers, and has user-configurable scrollbars (among a few other niceties).  On top of those changes, the default code path variable can now be configured directly in WordPress&#8217;s admin interface rather than editing the plugin code by hand&#8230;very nice!</p>
<h3 id="reactions">Reactions</h3>
<p>I don&#8217;t agree with all of the design choices they made with the new changes, but my qualms are minor.  Specifically, I don&#8217;t like some of the chosen defaults, nor the new format when specifying viewcode tags:<br />
<code>[viewcode ] src=/code/example.txt link=yes[/viewcode]</code><br />
&#8230;in comparison to the original:<br />
<code>&lt;viewcode src="/code/example.txt" link="yes" /&gt;</code></p>
<p>That said, it <em>is</em> a cool feeling to find out that other people appreciate your work and chose to carry on with its development in your absence.</p>
<h3 id="torch">Passing the Torch</h3>
<p>With the latest design incarnation here at ElasticDog, I decided to no longer use Code Viewer for displaying code snippets.  Instead, I went with the plugin <a href="http://www.thunderguy.com/semicolon/wordpress/code-markup-wordpress-plugin/">Code Markup</a>, which allows me to easily embed custom markup within code blocks.  It&#8217;s a completely different way of going about displaying code in blog entries when compared to Code Viewer, but it does the job well and suits my needs for the time being.</p>
<p>Although I haven&#8217;t actually worked on the development of Code Viewer since late 2004, I did register to have it hosted at the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Repository</a>.  Unfortunately, I never got around to packaging it up for general consumption.</p>
<p>Trying to not be a slacker anymore, I <em>have</em> contacted Håkan in hopes of persuading him to take the reins and officially manage the plugin at the centralized WordPress repository.  If he agrees, you should be able to download the plugin here very shortly:<br />
<a href="http://wordpress.org/extend/plugins/code-viewer/">http://wordpress.org/extend/plugins/code-viewer/</a></p>
<p>In the mean time, you can find the <a href="http://www.familjencarlstrom.se/WordPress/2006/08/17/code-viewer/">most up to date version of Code Viewer</a> at <a href="http://www.familjencarlstrom.se/WordPress/">Håkan&#8217;s site</a>.  Happy coding!</p>
---<br />Related Posts at ElasticDog:<ul><li><a href="http://elasticdog.com/2004/09/optimal-title/" rel="bookmark" title="September 8th, 2004">WP Plugin: Optimal Title</a></li>

<li><a href="http://elasticdog.com/2004/09/code-viewer/" rel="bookmark" title="September 26th, 2004">WP Plugin: Code Viewer</a></li>

<li><a href="http://elasticdog.com/2008/02/optimal-title-functionality-now-in-wordpress-core/" rel="bookmark" title="February 20th, 2008">Optimal Title Functionality Now in WordPress Core</a></li>

<li><a href="http://elasticdog.com/2008/04/comments-missing-in-wordpress-dashboard-after-251-upgrade/" rel="bookmark" title="April 25th, 2008">Comments Missing in WordPress Dashboard After 2.5.1 Upgrade</a></li>
</ul><!-- Similar Posts took 6.299 ms --><img src="http://feeds.feedburner.com/~r/elasticdog/~4/240182935" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://elasticdog.com/2008/02/current-status-of-the-code-viewer-wordpress-plugin/feed/</wfw:commentRss>
		<feedburner:origLink>http://elasticdog.com/2008/02/current-status-of-the-code-viewer-wordpress-plugin/</feedburner:origLink></item>
		<item>
		<title>Optimal Title Functionality Now in WordPress Core</title>
		<link>http://feeds.feedburner.com/~r/elasticdog/~3/238039699/</link>
		<comments>http://elasticdog.com/2008/02/optimal-title-functionality-now-in-wordpress-core/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 07:52:39 +0000</pubDate>
		<dc:creator>Aaron Schaefer</dc:creator>
		
		<category><![CDATA[WordPress]]></category>

		<category><![CDATA[Plugin]]></category>

		<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://elasticdog.com/2008/02/optimal-title-functionality-now-in-wordpress-core/</guid>
		<description><![CDATA[Since three and a half years ago, my Optimal Title plugin has been downloaded by tens of thousands of people and written about by hundreds of bloggers.  Soon, it will become obsolete...]]></description>
			<content:encoded><![CDATA[<p>I wrote <a href="http://elasticdog.com/2004/09/optimal-title/">Optimal Title</a> three and a half years ago to help fix a blatant flaw in <a href="http://wordpress.org">WordPress</a>&#8217;s default usability and search engine optimization (SEO).  Since then, the plugin has been downloaded by tens of thousands of people and written about by hundreds of bloggers.  Soon, the plugin will become obsolete&#8230;</p>
<h3 id="">A Change in WordPress v2.5</h3>
<p>As of the beginning of this year, a <a href="http://trac.wordpress.org/changeset/6538">changeset</a> was checked in to WordPress&#8217;s <abbr title="Subversion">SVN</abbr> repository which adds a &#8220;separator location&#8221; argument to the built-in <code>wp_title()</code> function.  What that means, is that when WordPress v2.5 is released around March 10th of this year, users will be able to change the ordering of their <abbr title="Hypertext Markup Language">HTML</abbr> title tags without having to use a third-party plugin.</p>
<p>The <a href="http://trac.wordpress.org/ticket/4407">developers decided</a> not to change the default behavior of <code>wp_title()</code>, and instead added the additional argument to the function in order to prevent breaking existing themes that rely on the current behavior.</p>
<h3 id="change">How to Make the Change</h3>
<p>If you&#8217;re currently using Optimal Title and want to change your template back to using <code>wp_title()</code> after upgrading to WordPress v2.5 (and you <em>should</em>), here&#8217;s what you need to do&#8230;</p>
<p>Using the simplified example from the <a href="http://elasticdog.com/2004/09/optimal-title/#usage">original Optimal Title article</a>, you should currently have something like this in your theme&#8217;s <kbd>header.php</kbd> file:</p>
<pre><code>&lt;title&gt;&lt;?php optimal_title(); ?&gt; &lt;?php bloginfo('name'); ?&gt;&lt;/title&gt;</code></pre>
<p></p>
<p>Just replace the function call <code>optimal_title()</code> with a call to <code>wp_title('&amp;raquo;',TRUE,'right')</code>, and you&#8217;ll end up with something like this:</p>
<pre><code>&lt;title&gt;&lt;?php wp_title('&amp;raquo;',TRUE,'right'); ?&gt; &lt;?php bloginfo('name'); ?&gt;&lt;/title&gt;</code></pre>
<p></p>
<p>That&#8217;s it!</p>
<h3 id="parameters">Parameters</h3>
<p>The <a href="http://codex.wordpress.org/Template_Tags/wp_title">wp_title codex page</a> won&#8217;t be updated until the next release, however, here is how <code>wp_title()</code> will work after WordPress v2.5 is out:</p>
<pre><code>&lt;?php wp_title('separator', display, 'seplocation'); ?&gt;</code></pre>
<p></p>
<ul>
<li>&#39;separator&#39; - <i>string</i> - The text to place between portions of the page title, such as the blog name and the category. Defaults to <code>'&amp;raquo;'</code> (&raquo;).</li>
<li>display - <i>boolean</i> - Should the title be displayed (<code>TRUE</code>) or returned for use in <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> (<code>FALSE</code>). Defaults to <code>TRUE</code>.</li>
<li>&#39;seplocation&#39; - <i>string</i> - The location of the separator in relation to the title.  All values default to the standard left position, with the exception of <code>'right'</code>, which will place the separator after the title rather than before.</li>
</ul>
<h3 id="glad">I&#8217;m Glad</h3>
<p>Even though it took so long to get this done, I&#8217;m glad WordPress finally came around to the idea and added Optimal Title&#8217;s functionality to the core.  Regardless of whether or not you were using Optimal Title before, I&#8217;d highly recommend that <strong>all</strong> users make this simple change to their templates in order to take advantage of the many benefits that a proper title tag has to offer.</p>
---<br />Related Posts at ElasticDog:<ul><li><a href="http://elasticdog.com/2004/09/optimal-title/" rel="bookmark" title="September 8th, 2004">WP Plugin: Optimal Title</a></li>

<li><a href="http://elasticdog.com/2004/09/code-viewer/" rel="bookmark" title="September 26th, 2004">WP Plugin: Code Viewer</a></li>

<li><a href="http://elasticdog.com/2004/10/faking-multiple-templates/" rel="bookmark" title="October 7th, 2004">Faking Multiple Templates in WordPress</a></li>

<li><a href="http://elasticdog.com/2008/02/current-status-of-the-code-viewer-wordpress-plugin/" rel="bookmark" title="February 23rd, 2008">Current Status of the Code Viewer WordPress Plugin</a></li>
</ul><!-- Similar Posts took 8.462 ms --><img src="http://feeds.feedburner.com/~r/elasticdog/~4/238039699" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://elasticdog.com/2008/02/optimal-title-functionality-now-in-wordpress-core/feed/</wfw:commentRss>
		<feedburner:origLink>http://elasticdog.com/2008/02/optimal-title-functionality-now-in-wordpress-core/</feedburner:origLink></item>
		<item>
		<title>HOWTO: Have Multiple Users Share an iTunes Library on One Machine</title>
		<link>http://feeds.feedburner.com/~r/elasticdog/~3/130546785/</link>
		<comments>http://elasticdog.com/2007/04/howto-have-multiple-users-share-an-itunes-library-on-one-machine/#comments</comments>
		<pubDate>Mon, 30 Apr 2007 03:20:46 +0000</pubDate>
		<dc:creator>Aaron Schaefer</dc:creator>
		
		<category><![CDATA[Guides]]></category>

		<category><![CDATA[iTunes]]></category>

		<category><![CDATA[Music]]></category>

		<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://elasticdog.com/2007/04/howto-have-multiple-users-share-an-itunes-library-on-one-machine/</guid>
		<description><![CDATA[I recently purchased a new MacBook (never having owned a Mac before), and have been reading up on keeping things secure.  Per one of those security-related suggestions, once everything was set up to my liking, I stopped using the admin account for everyday use and started forcing myself to log in as a regular [...]]]></description>
			<content:encoded><![CDATA[<p>I recently purchased a new MacBook (never having owned a Mac before), and have been reading up on keeping things secure.  Per one of those security-related suggestions, once everything was set up to my liking, I stopped using the admin account for everyday use and started forcing myself to log in as a regular user.  I&#8217;ve also created a user account for my live-in girlfriend so she can go wild customizing her desktop with pictures of flowers, Hugh Jackman, Hugh Jackman laying in a bed of flowers, and so on, without making my eyes bleed.</p>
<p>The trouble is, we both buy music from iTunes on a regular basis using our own individual Apple ID accounts, and there isn&#8217;t an easy way to share our music seamlessly with one another.  We have similar tastes in music and we&#8217;d like it so that when one person buys a new song, it is immediately available for the other person to listen to.  Ideally, we&#8217;d also be able to create our own unique playlists and assign ratings to the various songs to reflect our own personal likes/dislikes.  This article lays out the details of how I accomplished that goal&#8230;</p>
<h2 id="problem">The Problem</h2>
<p>The main problem with assigning two iTunes Libraries to the same location comes down to permissions.  By default, when you download music through iTunes, it assigns permissions based on the user that&#8217;s logged in.  It only allows that user and people in the UNIX group &#8220;wheel&#8221; to read the music file (if you&#8217;re UNIX-literate, that means it has 640 file permissions).  Since a different user (in this case, my girlfriend) would not fit into those categories, she doesn&#8217;t have the proper permissions to read any of the music I download.  To put it simply&#8230;music needs to be world readable.</p>
<h2 id="solution">The Solution</h2>
<p>These permissions can be easily fixed by running a <a href="/code/2007/04/share-itunes">simple script</a> that uses the <code>chmod</code> command to modify your music so anyone can play it.  To give you a breakdown, <a href="/code/2007/04/share-itunes">the script</a> runs a few safety checks to ensure that you have the proper permissions to modify the files, it then checks that your specified library actually exists, and then it recursively looks at all of your music making sure it is world readable.</p>
<p>The trick is getting the script to run only when necessary as not to waste resources.  You could set up a cron job, but then it would have to run on a fixed time table.  Either it would run more often than necessary, or not often enough&#8230;so cron is out.  You could set up a launchd/launchctl configuration file and specify it to run when your Library folder is modified, but unfortunately that doesn&#8217;t get triggered when a <em>sub</em>-folder gets modified&#8230;so launchd is out.</p>
<p>The key ends up being something called a &#8220;LoginHook&#8221; that is configured in the <code>/etc/ttys</code> file.  Creating a LoginHook will ensure that whenever any user logs in to the machine, the script will be run and proper permissions will be set on the entire library.</p>
<h2 id="together">Putting it All Together</h2>
<p>This should go without saying, but I&#8217;m saying it&#8230;<strong>back up all of your music files before doing anything else</strong>!  Once that&#8217;s done, proceed with the following steps:</p>
<ol>
<li>First you must pick a centralized location that all your users have access to and make sure the directory exists.  I picked /Users/Shared/Music/iTunes and created it on the command-line using:<br /><code>mkdir -p /Users/Shared/Music/iTunes</code></li>
<li>Next, you must adjust your iTunes settings to point to the new location.  You do this by launching iTunes, then navigate to <em>iTunes &raquo; Preferences&#8230; &raquo; Advanced</em>, and under the <em>General</em> tab, click the <em>Change&#8230;</em> button next to the &#8220;iTunes Music folder location&#8221; box.  Navigate to your newly-created centralized folder (in my case /Users/Shared/Music/iTunes), and click <em>Choose</em>.</li>
<li>For ease of maintenance and to prevent duplicate files from being generated, make sure the checkbox labeled &#8220;Copy files to iTunes Music folder when adding to library&#8221; is <strong>not</strong> selected (this is also under the <em>Advanced</em> section of the Preferences dialog box).</li>
<li>Click <em>OK</em> to accept the changes you made to your preferences.</li>
<li>To copy your current library to the new location, navigate to <em>Advanced &raquo; Consolidate Library&#8230;</em> then proceed by clicking <em>Consolidate</em>.  This step only needs to be performed one time per user to ensure that everything gets moved over to the new location.</li>
<li>Repeat these configuration steps for all users that you wish to consolidate libraries for.</li>
</ol>
<p>At this point, you&#8217;ve done all that is necessary to do within iTunes, and all that is left is fixing the file permissions.  To do that, log in as a user with administrator privileges and follow these steps:</p>
<ol>
<li>Download <a href="/code/2007/04/share-itunes">the script</a> and put it anywhere you want.  I made another directory called <code>/Users/Shared/bin/</code> and put the script there, but the location doesn&#8217;t really matter.</li>
<li>Modify the script&#8217;s <code>LIBRARY</code> variable (in the <code>CONSTANTS</code> section) to point to the centralized music directory you created above.</li>
<li>Ensure that the script is executable by running:<br /><code>chmod 755 /Users/Shared/bin/share-itunes</code>
<li>Then edit the <code>/etc/ttys</code> file with your favorite text editor, and change the line starting with &#8220;console&#8221; to add:<br /><code>-LoginHook /Users/Shared/bin/share-itunes</code><br />right after the &#8220;loginwindow&#8221; declaration.  Make sure you actually point it to the location where you downloaded the script to.  The line should have looked something like this before you edited it:
<p></p>
<pre><code>console "/System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow" vt100 on secure onoption="/usr/libexec/getty std.9600"</code></pre>
<p>&#8230;and look like this after you edit it:</p>
<pre><code>console "/System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow <em>-LoginHook /Users/Shared/bin/share-itunes</em>" vt100 on secure onoption="/usr/libexec/getty std.9600"</code></pre>
</li>
<li>Save the file, and close your text editor.</li>
</ol>
<p>That&#8217;s it!  Everything should be all set to go and your permissions will be checked each time you log in to the computer.  </p>
<h2 id="caveats">Caveats</h2>
<p>The only thing I wasn&#8217;t able to automate was adding new music purchased by my girlfriend in to my library so it actually shows up when I launch iTunes.  For all I know, there may be an easy way to automate it, but I haven&#8217;t found one at this time.  Luckily it&#8217;s a fast/easy procedure to do by hand&#8230;</p>
<p>To actually have new music purchased by another user show up in your library, all you have to do is launch iTunes, go to <em>File &raquo; Add to Library&#8230;</em>, then navigate to your shared music folder and click <em>Choose</em>.  It will take a few seconds to parse through your library, but after it&#8217;s done, all of the music should be available for you to play.  You will have to do that every time you know that music has been added by another user, but everything else should be automated for you.</p>
<h2 id="why">Why it Works</h2>
<p>Unless you get tricky, iTunes always stores your album artwork, playlists, and song rating information in a file under your home directory (well, in ~/Music/iTunes, to be precise).  It also stores a meta file with information regarding what it thinks should be included in your library.  These files will be unique to the user even if you choose to share your actual music collections.  So when you update your iTunes preferences to move the location of your Library, you still retain the ability to have all your own custom settings regardless of what other users add to the common music folder.</p>
<p>By periodically telling iTunes to add the common music directory in to your library, you&#8217;re simply forcing it to update the library meta file so it reflects whatever actually exists in that directory&#8230;regardless of whether or not you were the person to purchase the music.</p>
<p>Hopefully these steps will be able to help someone else out there having a similar issue.  When I first started looking in to how to accomplish this configuration, I though surely it would be easy and done before, but alas, things got a bit more complicated than I had hoped.  If you know of a better way, please do leave a comment and let us know what works for you.  If you have any trouble understanding these procedures or getting it to work, let me know and I&#8217;ll see what I can do to help out&#8230;happy listening!</p>
---<br />Related Posts at ElasticDog:<ul>None Found
</ul><!-- Similar Posts took 4.906 ms --><img src="http://feeds.feedburner.com/~r/elasticdog/~4/130546785" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://elasticdog.com/2007/04/howto-have-multiple-users-share-an-itunes-library-on-one-machine/feed/</wfw:commentRss>
		<feedburner:origLink>http://elasticdog.com/2007/04/howto-have-multiple-users-share-an-itunes-library-on-one-machine/</feedburner:origLink></item>
	</channel>
</rss>
