log in

nerdylorrin.net

Wiki: WordPress

Your trail: MythTV

Installation

  1. Install the wordpress package.
  2. Add one of the Apache stanzas from /usr/share/doc/wordpress/examples/apache.conf to your Apache configuration. If you've denied access to everything by default add in Order allow,deny Allow from all
  3. chmod +x /usr/share/doc/wordpress/examples/setup-mysql
  4. Run /usr/share/doc/wordpress/examples/setup-mysql -n blogname www.domain.name and ignore the failed symlink operation at the end.
  5. Reload Apache and visit the blog

Multiple path-based blogs

By default VirtualHosts are used to distinguish between multiple blogs. In some cases I prefer to place multiple blogs on the same VirtualHost using different paths. This requires a little tweaking.
  1. Change the require_once('/etc/wordpress/config-'.strtolower($_SERVER['HTTP_HOST']).'.php'); line in /etc/wordpress/wp-config.php to be require_once('/etc/wordpress/config-'.strtolower($_SERVER['HTTP_HOST']).'.'.strtok($_SERVER['REQUEST_URI'],'/').'.php'); This will cause blogs to be distinguished by VirtualHost and the first element of the path.
  2. Create a new blog as before: /usr/share/doc/wordpress/examples/setup-mysql -n blogname www.domain.name
  3. Rename the generated file /etc/wordpress/config-www.domain.name.php to config-www.domain.name.pathname.php. Where pathname matches the first element of the path where the blog we be available (e.g. in this case http://www.domain.name/pathname/morepath/blog).

If you decide to delete the blog later on (/usr/share/doc/wordpress/examples/setup-mysql -d blogname www.domain.name) rename the config file back to /etc/wordpress/config-www.domain.name.php first.

Themes

A huge number of WordPress themes are available. WordPress "Styles" are an older skinning format for WordPress 1.2. Also check out Tarski, Rebecca Wei's themes, and Plaintxt.org themes.

Plug-ins

Gallery Integration

WPG2 integrates WordPress with Gallery.

Email Notification

It turns out that it's tedious to send email notifications to users who aren't hip to RSS. There a couple plug-ins that help you send an email to a mailing list when there's a new post, and there are free services out there your users could use that do the job. But neither of these approaches is particularly good for just emailing a few non-tech-savvy users who want a super-simple sign-up process.

The only option I found was Watershed Studio's WordPress Email Notfication Plugin. Unforunately it's tedious to get working.

  1. As per the install.txt, files go in /usr/share/wordpress/wp-content/plugins/wp-email-notification and in /usr/share/wordpress/maillist.
  2. Make maillist/wpemn_config.php writable, visit maillist/install.php with a web browser.
  3. Filling out the form (don't select the HTML emails, they're really foogly) will do two things:
    1. Write your database access configuration to wpemn_config.php
    2. Create database tables wp_email_list, wp_email_list_config, wp_email_list_future.
  4. Activate the plugin in WordPress site admin
  5. Put the form code somewhere in your template and then play with the CSS to make it pretty.

So far so good, except multi-site installs are not supported.

  1. Create the tables in the other blog's database: mysqldump --all --no-data wp_firstblog wp_email_list | mysql wp_otherblog mysqldump --all --no-data wp_firstblog wp_email_list_future | mysql wp_otherblog mysqldump --all wp_firstblog wp_email_list_config | mysql wp_otherblog
  2. Adjust the data in wp_email_list_config as needed: update wp_email_list_config set site_name = 'Other Blog', site_url='http://www.nerdylorrin.net/other_blog/', blog_url='http://www.nerdylorrin.net/other_blog/';
  3. Make /usr/share/wordpress/maillist/wpemn_config.php be site-dependent the same way the Debian /etc/wordpress/wp-config.php is: //hostname driven //require_once('/etc/wordpress/config-'.strtolower($_SERVER['HTTP_HOST']).'.php'); //hostname + URL driven: require_once('/etc/wordpress/config-'.strtolower($_SERVER['HTTP_HOST']).'.'.strtok($_SERVER['REQUEST_URI'],'/').'.php'); # Database Information $db = DB_NAME; $dbuser = DB_USER; $dbpass = DB_PASSWORD; $dbhost = DB_HOST;
  4. chmod 600 upgrade.php install.php
  5. Enable plug-in and update HTML in other blogs.
    1. But what if some blogs enable the plug-in and others don't? Wrap HTML changes inside if (function_exists('email_notification_admin')) { ... } so they only show up when the plugin is enabled.

Be warned that the v2.3.1 (December 8, 2005) release has a common security hole that can exploited to send huge amounts of spam through the sign-up form.

The fix is fairly simple and done in maillist/index.php:

  1. Append an email address validation function to the end of the file. This one was written by Dave Child. //********************************************************// // FUNCTION - check_email_address //********************************************************// function check_email_address($email) { // First, we check that there's one @ symbol, and that the lengths are right if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. return false; } // Split it into sections to make life easier $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; // Not enough parts to domain } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; }
  2. Towards the top, as the first step inside the SUBSCRIBE if block, insert the following: if (! check_email_address($addr)) { echo "'$addr' doesn't appear to be a valid email address. <br/><br/>Subscription attempt aborted."; exit; }

Troubleshooting

WordPress database error: [Unknown column 'category_count' in 'field list']
SELECT cat_ID, cat_name, category_nicename, category_description, category_parent, category_count FROM wp_categories WHERE cat_ID > 0 ORDER BY cat_name asc
No categories
  1. Add missing column: alter table wp_categories add category_count bigint(20) NOT NULL default '0';
  2. Manually figure out how many entries are in each category. (You'll have to add by hand): (select link_category as category_id, count(*) from wp_links group by category_id) union all (select category_id, count(*) from wp_post2cat group by category_id);
  3. Update the rows in wp_categories. For each category e.g.: update wp_categories set category_count = 13 where cat_ID = 2;
Unable to create directory /usr/share/wordpress/wp-content/uploads/2006/02. Is its parent directory writable by the server?"

Do a mkdir /usr/share/wordpress/wp-content/uploads; chown www-data:www-data /usr/share/wordpress/wp-content/uploads

Alternatives

SitePoint has a comparison with Movable Type and Textpattern (2005-11)


[RSS] Creative Commons License
This work is licensed under a Creative Commons License.
Edit this page   More info...   Attach file...
Pages referencing this one include Gallery Groupware
This page last modified 14-Jan-2007 10:54:50 PST by LorrinNelson.