Frequently Asked Questions: Blogging
Do you have any software for managing a weblog?
Not really: there is an installation of Movable Type on the system but it's rather old (version 2.661) and the MT licensing terms don't permit upgrading to the newer versions without purchasing a commercial license. Our intention is to eventually phase out the MT system.
Our recommendation is that a good, properly free implementation of a weblog manager is WordPress which is powerful, standards-compliant and otherwise quite sensible, as well as having a good license from our point of view. However, it's not really compatible with running a centralised copy on the system, so you'll have to install a local copy in your web area: this is very easy and more flexible for all concerned. Happy blogging!
WordPress Tips: UTF-8 character encodings and RSS feeds
Some tips for using wordpress on the SRCF.
How do I move my weblog from Movable Type to WordPress?
Thankfully, this is possible: just follow the instructions below (courtesy of Hanna — thanks!)
Preparation:
- Make sure your host meets the WordPress requirements. (SRCF users need not worry; pip has everything required.)
- Ask your host admins for a MySQL database, and make sure you know the username and password. (Note: SRCF policy is one database per user/society. If you already have a database and you wish to separate your WP tables from existing tables, use a table prefix such as wp_. If you have forgotten your MySQL password, ask the sysadmins to reset it.)
WP Installation:
- Log into your host. (For SRCF users, this is pip.srcf.ucam.org.)
- Download the latest version of WP (wget http://wordpress.org/latest) and extract the files (e.g. tar zxvf wordpress-1.0.2-blakey.tar.gz).
- Move the contents of the extracted directory into ~/public_html (e.g. mv wordpress-1.0.2/* ~/public_html). If you are migrating from MT to WP and would like your new WP blog to reside in the directory currently used by MT (e.g. ~/public_html/mt) then move the files to that directory instead. If you would like to install WP in a new directory in your webspace (e.g. ~/public_html/wp), create the new directory (e.g. mkdir ~/public_html/wp) and move the files into it.
- cd to the directory now containing your WP files.
- Use your favourite editor to edit wp-config-sample.php, filling in your database details (database name, username, password, database host). (Note: on pip, both your database name and username are your CRSID and the database host is localhost.) Change the $table_prefix variable to the prefix you wish to use for your WP tables (e.g. $table_prefix = ‘wp_’;
- Move wp-config-sample.php to wp-config.php.
- Make sure wp-config-sample.php isn't world-readable: it contains password data! To do this, run chmod o-r wp-config.php.
- Run the installation file by pointing your browser at install.php in the wp-admin directory inside the directory containing your WP files (e.g. http://www.srcf.ucam.org/~CRSID/wp/wp-admin/install.php).
Accounts:
- Log in to WP as admin using the password given at the end of the installation process.
- Click on My Profile and change the admin password using the form provided.
- Click on Users and create an account for yourself. (If you planning to import entries from your MT blog, be sure to use the same username as your MT user account. If your MT blog has multiple authors, you must create a user account for each of them.)
Migration from MT (based on the tutorial here):
- Log into MT.
- Click on the Manage Weblog link for the blog you wish to migrate.
- Select Import/Export from the left menu.
- Click on the Export Entries from … link at the bottom of page. This should display a large text file (containing all your MT blog entries) in your browser. If text may be displayed as a single long line (as may be the case if you are using IE), the import into WP will not work correctly. Try using a Gecko-based browser (e.g. Netscape, Mozilla or FireFox) instead.
- Save the file displayed in your browser as a text file with the name import.txt on your local computer.
- Using SCP, FTP or SFTP, upload import.txt to the wp-admin directory inside the directory containing your WP files on your host. (Note: if necessary, SRCF users may email the sysadmins for help on this step.)
- On your host, cd to the wp-admin directory.
- Use your favourite editor to change line 2 of import-mt.php from define(’MTEXPORT’, ‘’); to define(’MTEXPORT’, ‘import.txt’);.
- Making sure you’re logged into WP as admin, point your browser at import-mt.php (e.g. http://www.srcf.ucam.org/~CRSID/wp/wp-admin/import-mt.php).
- Click on Let’s go.
- Log out of the admin account and log back into WP using your previously created user account. You may now edit your imported entries. If you imported entries by multiple authors, you will only be able to edit those written by yourself.
Blacklist:
- Log into your host.
- Download the latest version of WP Blacklist (wget http://dinki.mine.nu/word/b2-img/wpblacklist.zip) and extract the files (e.g. unzip wpblacklist.zip).
- Using your favourite editor, edit the first two lines of import_blacklist.php, filling in your database details. (Recall that on pip, both your database name and username are your CRSID, and the database host is localhost.)
- Immediately after line 2, insert the following, making sure you use the same prefix (e.g. wp_) as the one specified previously in wp-config.php.
- $table_prefix = ‘wp_’;
$blacklist_table_name = $table_prefix . ‘blacklist’;
- $table_prefix = ‘wp_’;
- Search for $request = mysql_query("CREATE TABLE blacklist ( and replace it with $request = mysql_query("CREATE TABLE $blacklist_table_name (.
- Similarly, replace $request = mysql_query("INSERT INTO blacklist (domain) VALUES (’$temp’)"); with $request = mysql_query("INSERT INTO $blacklist_table_name (domain) VALUES (’$temp’)");.
- Move import_blacklist.php and blacklist.txt to the directory containing your WP files.
- Point your browser to import_blacklist.php (e.g. http://www.srcf.ucam.org/~CRSID/wp/import_blacklist.php). This should display several “imported domain/regex” messages.
- Delete import_blacklist.php and blacklist.txt.
- Open wp-comments-post.php in your favourite editor, and insert the following immediately below require(dirname(__FILE__) . ‘/wp-config.php’); making sure you use the same prefix (e.g. wp_) as the one specified previously in wp-config.php.
- $table_prefix = ‘wp_’;
$blacklist_table_name = $table_prefix . ‘blacklist’;
- $table_prefix = ‘wp_’;
- Search for the following in wp-comments-post.php:
- if (’manual’ == $comment_moderation) {
$approved = 0;
} else if (’auto’ == $comment_moderation) {
$approved = 0;
} else { // none
$approved = 1;
}
- if (’manual’ == $comment_moderation) {
- Paste this immediately below it:
- $blacklists = $wpdb->get_results("SELECT domain FROM $blacklist_table_name");
foreach ($blacklists as $blacklist) {
$regex = “/”.$blacklist->domain."/i”;
if (@preg_match($regex, $url))
$approved = 0;
if (@preg_match($regex, $email))
$approved = 0;
if (@preg_match($regex, $comment))
$approved = 0;
}
- $blacklists = $wpdb->get_results("SELECT domain FROM $blacklist_table_name");
- Open menu.txt in the wp-admin directory inside the directory containing your WP files and search for the line containing 3 users.php Users. Add the following line immediately below it: 3 modBlacklist.php Blacklist.
- Open modBlacklist.php and insert the following below /* Edit */ again making sure you use the same prefix (e.g. wp_) as the one specified previously in wp-config.php:
- $table_prefix = ‘wp_’;
$blacklist_table_name = $table_prefix . ‘blacklist’;
- $table_prefix = ‘wp_’;
- Replace $postquery ="SELECT * FROM blacklist”; with $postquery ="SELECT * FROM $blacklist_table_name”;.
- Replace both instances of $request = $wpdb->get_row("SELECT id FROM blacklist WHERE domain=’$temp’"); with $request = $wpdb->get_row("SELECT id FROM $blacklist_table_name WHERE domain=’$temp’");.
- Replace both occurrences of $request1 = $wpdb->query("INSERT INTO blacklist (domain) VALUES (’$temp’)"); with $request1 = $wpdb->query("INSERT INTO $blacklist_table_name (domain) VALUES (’$temp’)");.
- Move modBlacklist.php and blacklistForm.php to the wp-admin directory inside the directory containing your WP files.
Redirection of old MT entries using .htaccess:
- Note that this method only works if you have been using MT permalinks containing entry IDs (e.g. http://www.srcf.ucam.org/~CRSID/mt/archives/000123.html).
- Log into WP.
- Click on Options and select Permalinks.
- Enter /%year%/%monthnum%/%day%/%postname%/ into the text field.
- write text editor, create a file .htaccess in the directory containing your WP files. Copy and paste the rewrite rules displayed in the text area into .htaccess.
- Paste the following text into your .htaccess file, immediately below the rewrite rules:
- Redirect Permanent /~CRSID/mt/index.html http://www.srcf.ucam.org/~CRSID/wp/index.php
Redirect Permanent /~CRSID/mt/index.rdf http://www.srcf.ucam.org/~CRSID/wp/wp-rdf.php
Redirect Permanent /~CRSID/mt/index.xml http://www.srcf.ucam.org/~CRSID/wp/wp-rss.php
- Redirect Permanent /~CRSID/mt/index.html http://www.srcf.ucam.org/~CRSID/wp/index.php
- Log into MT.
- Click on the Manage Weblog link for the blog whose posts you wish to redirect.
- Select Templates from the left menu.
- Click on Create new index template.
- Call the new template redirect and specify redirect.php as its output file.
- Assuming your MT archives are in ~/public_html/mt/archives/ and your WP blog files are in ~/public_html/wp/, the template’s body should contain the following:
- < ?php
require(’wp-config.php’);
header(’Content-type: text/plain’);
?>
<MTEntries lastn="999999″></MTentries>
Redirect Permanent /~CRSID/mt/archives/< ?php echo str_pad(”<$MTEntryID$>”, 6, “0″, STR_PAD_LEFT); ?>.html http://www.srcf.ucam.org/~CRSID/wp/<$MTArchiveDate format="%Y/%m/%d"$>/< ?php echo sanitize_title(”<$MTEntryTitle$>"); ?>
- < ?php
- Save and rebuild the template.
- On pip, you also need to change the owner of redirect.php from mt to your CRSID. Since the file is owned by mt, you cannot do this using chmod. Instead, you will need to create a new file tmp.php, copy the text from redirect.php to tmp.php, delete redirect.php and rename tmp.php to redirect.php.
- Point your browser to redirect.php (e.g. http://www.srcf.ucam.org/~CRSID/mt/redirect.php. This should display a list of permanent redirect statements. Copy the list displayed on your browser into your .htaccess file, below the rewrite statements.
And that’s it!