Sweet, a new version of BBPress has been released! I’ll upgrade Bui4Ever’s BBPress 0.8.1 to the latest version. There are some major code upgrades that fix long annoyances.
Category: Web
WordPress Mu with Domain Mapping
Please note that as of August 11, 2008, Donncha has released a domain mapping plugin that makes this process easier at the cost of creating subdomains off the newly mapped domains. On the other hand, the XML-RPC continues to work.
Introduction
WordPress has been absolutely amazing. It has grown from merely being a blogging platform to more of a CMS/blog platform now. With WordPress Mu (Multi-User), it takes WordPress to a whole new level by allowing for multiple instances of WordPress on one install with one database! The best example of WordPress Mu in use is WordPress.com.
A new feature that was introduced on WordPress.com is domain mapping. Currently when a user visits a WordPress Mu installed site (depending on if the install is subdomain or subdirectory), and signs up for a new blog, the url is http://subdomain.domain.tld/. What domain mapping allows is for a user with a registered domain name to park it on their site at http://subdomain.domain.tld/.
What is the advantage of being able to do this? Well for me, it’s quite advantageous. Since I run multiple WordPress sites, instead of having to download WordPress, upload it, configure it, etc., I can create a new subdomain blog on my main site and then use domain mapping to make the subdomain appear as it’s own domain site. This allows me to share the user tables, themes, plugins, etc. thereby saving space, have only one database to backup and so on.
Unfortunately there is no easy and quick way to do domain mapping with WordPress Mu (yet). There are a few threads on WordPress Mu’s support forum on how to do it, but I figured I’ll make a clear and precise directions on how to achieve domain mapping. Much of the directions I use are from drmike’s thread at the WordPress Mu support forums.
Prerequisites
Before you can use domain mapping on WordPress Mu, there are certain criteria that your WordPress install must meet.
- It must be a WordPress Mu install and not a WordPress install and it has to be working correctly.
- The WordPress Mu install must utilize SUBDOMAIN and not subdirectory feature.
- You must already have a domain name registered that you wish to use.
Please note that while it is not impossible to do domain mapping on hosted websites, it will be much more easy and worthwhile to have at least a virtual private server (VPS) or dedicated server, or you will have to contact your host each time you wish to add another domain to your WordPress Mu install. The instructions I present are based on a person with a VPS.
Disclaimer
I provide these directions for my own reference and for other people who are interested. Use all or any part of this guide at YOUR OWN RISK. I take no responsibility for what may happen by following this guide. Always remember to make backups of your database before making any drastic changes FIRST!!!
Instructions
- Login into your domain name registrar, and edit the nameservers to match your WordPress Mu domain nameservers. Most registrars will let you do this yourself, but in some rare cases, you may have to contact them. This process can take anywhere from 10 minutes (if it is a newly created domain name) to 24-48 hours to resolve correctly.
- Login into you main site’s cpanel and select PARKED DOMAINS.

- Under “New Domain Name:”, enter the registered domain name that you want to do domain mapping with minus “www” prefix. In my case, I want to domain map http://www.abunchofcars.com, so I enter abunchofcars.com into the field. Click “Add Domain!”

- You should get something to this effect:
Parked Domain Additions Using nameservers with the following IPs: 216.246.58.57,216.246.58.58 Bind reconfiguring on vps using rndc Created DNS entry for abunchofcars.com abunchofcars.com was successfully parked on top of bui4ever.com
If you get an error, it usually means that the nameservers have not resolved fully yet and you will have to wait a bit longer before continuing to this step.

- Once the domain name has been parked, login into your web host manager (WHM), usually located at http://domain.tld/whm/.
- Scroll down the left hand list until you find the category, “DNS Functions”. Click on “Edit DNS Zone” and select the parked domain name and click “Edit”.

- Inside you’ll find a bunch of things. What we are looking for is under Domain your parked domain name, TTL of 14400, Record Type of A and next to it an IP address. We want to copy that entire IP address.

- Scroll all the way down to where you see “Add New Entries Below this Line”, we need to create a new entry.
- This is what you should type in there: *, 14400, A, 216.246.58.46, obviously changing my information to your information.

- Click “Go” and you should get a “Zone Modified!” message.

- You will need to restart apache for this to take effect. If you have a VPS or dedicated server:
httpd restart
in a command line should do the trick.
- Now login as Admin to your WordPress Mu site.
- Under “Site Admin” > “Blogs” > “Add Blog”, create a new blog naming it anything you want for now. Test to make it sure it works.
- Once the new blog has been created, go back to “Site Admin” > “Blogs”, find the newly created blog and select “Edit”.


- There are four places we need to make changes at. Under URL, you will see http://abunchofcars.bui4ever.com/, change that to http://abunchofcars.com/. Look for Siteurl, Home, and Fileupload Url and make the same changes as you did with Url, but leaving the suffix of “files” at the end of the Fileupload Url. Please note that it is very important that if the address has a trailing slash, you also include the trailing slash.




- Click “Update Options”, once it’s done, you’ll be returned to “Blogs” and notice that the newly created blog no longer is in the list.
- Before we can access the newly created blog, we need to make some changes in the MySQL database. Login to your CPANEL and PHPMYADMIN (I highly recommend you get the PHPMyAdmin plugin so you don’t have to always login to CPANEL to access PHPMYADMIN).
- Select the correct database from the drop down under “Database”.
- On the left hand side, scroll down until you see “wp_blogs”. Click on it and it should open in the right hand side. Click on “Browse” in the menu.


- Scroll down and you will see a list of all the blogs that have been registered. At the very end of the list, you should see abunchofcars.com under “Domain”. Click the pencil icon to edit that entry.

- Once it finishes loading, we want to change “site_id”‘s value to be the same as “blog_id”. For me, abunchofcars.com’s blog_id is 25, so I change site_id 1 to 25, and click “Go”. What this does is remove bui4ever.com (site_id 1) as the “blog owner” and make abunchofcars.com its own blog owner. Also you should remember the blog_id, as you will need it for the next few steps.

- On the left hand side, scroll down until you see “wp_site”. Click on it and it should open in the right hand side. Click on “Browse” in the menu.

- You should see one entry for your main blog. What we need to do is add an entry for abunchofcars.com. Click on “Insert” and we need to populate three values.

- For “id”, we enter the blog_id, in my case, 25. For “domain”, we enter the domain address, so I enter abunchofcars.com. And finally for path, we just put a forward slash (/). Click “Go”.

- So when you go back to wp_site and click “Browser”, you see your new entry.
- On the left hand side, scroll down until you see “wp_sitemeta”. Click on it and it should open in the right hand side. Click on “Browse” in the menu.
- We need to duplicate the contents of “meta_id” 6, the site_admins. Click on the pencil to edit it.

- In the “meta_value” field, you will see a big box with an entry:
a:1:{i:0;s:5:"admin";}Copy in its entirety.
- Click back on wp_sitemeta, and select “Browse”. Go to the very last entry, and make note of the “meta_id” number. Now click “Insert”.
- We need to make entries now, under “meta_id”, enter the next consecutive from the number you made note of in Step 27. In my case, the last entry was 64, so I will be using 65. The “site_id” you use is from Step 19, so I will enter 25. The “meta_key” is site_admins. In the big field under “meta_value”, paste the weird string we copied in Step 26. Click “Go”.

- We need to duplicate another entry, click wp_sitemeta and “Insert”. For “meta_id”, we need to use the next consecutive number. Under “site_id”, we use the same number from Step 19. For “meta_key”, enter site_name. In “meta_value”, enter in your parked domain address. In my case, I would enter abunchofcars.com. Click “Go”.

- The final entry that needs to be duplicated is “illegal_names”. So go back to wp_sitemeta, and click “Insert”. For “meta_id”, it needs to be the next consecutive number from what was used in Step 29. For “site_id”, enter the site_id from Step 19. The “meta_key” is illegal_names and the “meta_value” entry is
a:7:{i:0;s:3:"www";i:1;s:3:"web";i:2;s:4:"root";i:3;s:5:"admin";i:4;s:4:"main";i:5;s:6:"invite";i:6;s:13:"administrator";} - Now we should be good to go for testing. Open a web browser and enter in your parked domain address, I enter http://abunchofcars.com and you should see a newly created WordPress blog. If you don’t, a mistake was made somewhere.

- The next step is test login. Try your admin login and you should get in fine. Please note, if you type http://abunchofcars.com/wp-admin it will redirect you to your main site’s site admin. It is very important that you include a trailing slash after wp-admin, so http://abunchofcars.com/wp-admin/. Hopefully this issue will be resolved in the near future.
- Now another cool feature of the domain mapping, is that you can also create subdomain blogs off of the newly mapped domain. I can create http://how-to.abunchofcars.com and users can also sign up for their own blogs as they do on the main site. Cool huh?
MAMP: Mac, Apache, MySQL, PHP
Introduction
Before my friend introduced me to MAMP (Mac + Apache + MySQL + PHP), I wasn’t really able to do much web producing commuting to work. I was limited to making site mockups using Adobe Photoshop CS2 and some basic coding, but I couldn’t actually make the pages until I had internet connection so I could upload my test site to the sandbox.
Then came along MAMP, an all-in-one application for Mac OS X that allows you to locally host a web server! This was fantastic because now I can develop, hard code, check changes, and make all the changes I want without having an internet connection. It also lets me test run PHP codes or scripts that may be unstable and vulnerable without risking the web server.
How To Install
Installing and configuring MAMP is very, very easy.
- Download the latest copy of MAMP from the MAMP website. After it is done downloading, double click the downloaded file to unzip the contents.
- Drag the MAMP folder into the Applications folder.

- Once MAMP has completed copying into the Applications folder, you can find the executable at Applications>MAMP>MAMP.

- When you start it up, you’ll notice two things will appear: (1) the MAMP admin panel and (2) http://localhost:8888/MAMP/?language=English loaded into your default web browser.
- From the admin panel you can stop and start the Apache and MySQL servers.

- Your default web url is http://localhost:8888/ and your public folder is located (by default) at Applications>MAMP>htdocs. So anything that is placed within the htdocs folder will appear at http://localhost:8888/. Please note that this web address is local only and others will not be able to see it or the contents even if your computer is connected to the internet. I’ve seen where some people have mistakingly thought that MAMP can be used as a live web server. No, this was only designed to allow people to work locally.
- To change the default location of what folder will be the web folder, in MAMP, go to the menu bar and select Preferences and then select the Apache tab. Enter or select a new location.

How To Integrate WordPress and BBPress
Introduction
WordPress is the light (3.5 MB unzipped) blog and content management system application that powers this site and all my other sites. It makes adding and updating content very simple and allows others to add and/or update content easily also.
BBPress is the forum application that can either be used as a stand alone or in conjunction with WordPress.
What this guide is designed to do, is show how to integrate BBPress visually into a WordPress theme. I’ll be showing step by step how I did it.
Please Note: Recently updated for BBPress 0.8.1.
What You Need
- WordPress installed and functioning. Download the latest version of WordPress here.
- BBPress installed and functioning in the same database as WordPress. Download the latest version of BBPress here.
- BBPress Registration Synchronization with WordPress plugin.
- Moderator’s Display Name plugin (optional).
A Word of Warning
Depending on which theme you are using and who created it and your HTML skills, how easy or difficult it will be to integrate BBPress visually into WordPress is determined by how well written the WordPress theme your using is and/or your abilities to “fix” it or modify it to fit your needs.
In most cases, if the header.php file contains the usual head information and the navigation, you’ll probably be fine.
WordPress
- Open your WordPress’s Theme’s header.php and locate where your stylesheet is called up. You have to place a link to your BBPress stylesheet. For example, I use the import stylesheet feature, so mine looks like this:
<style type="text/css" media="screen"> @import url(<php bloginfo('stylesheet_url'); ?>; @import url("http://www.my-website.com/bbpress/my-templates/style.css"); </style>This was the method I use to use, but I’m not sure if this will create problems down the road, so I’m defaulting to a safer method. Please skip to BBPress section instead.
BBPress
- Open the config.php file located inside the BBPress parent directory.
- At the very beginning, before, where it says:
<?php // ** MySQL settings ** //
- You want to add this right above:
<?php require_once('/absolute/path/to/WordPress Parent Directory/wp-blog-header.php') ?> - What this does is that it is telling BBPress to load all the WordPress functions so that you can use WordPress functions inside of BBPress which will make integrating the look and feel of your BBPress to WordPress very, very easy.
- Upload the config.php file you just modified to your webserver and refresh the BBPress page, nothing should look different and you should not get any errors. If you get some kind of php error, look back in your code to make sure you didn’t mispell something.
- Make a copy of the entire bb-templates folder inside of the BBPress parent directory and rename it to my-templates. You should now have a my-templates folder with the same contents as the bb-templates folder in the BBPress parent directory. Any edits we will make will only to be the contents inside of the my-templates. Note: This is deprecated in BBPress 0.8.1.
- Create a new theme directory in bb-templates. Copy ALL the files in the kakumei theme in the newly created directory. The files copied in the new directory are the ones that you are to edit, not the files in the kakumei theme.
- I usually find the easiest way to start the visual integrating process is to edit the front-page.php file first since that page is BBPress’s equivalent of an index.php file. Open up front-page.php in a text editor program (e.g. Notepad for Windows or TextWrangler for the Mac).
- On the very first line, you will see:
<?php bb_get_header(); ?>
- Leave the bulk info in the <head></head> alone. What you want to do is add in
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" />above
<link rel="stylesheet" href="<?php bb_stylesheet_uri(); ?>" type="text/css" />
This will import the main look and feel of your WordPress theme into BBPress.
- Scroll to the bottom and find:
<?php bb_get_footer(); ?>
- Change that to:
<php get_footer(); ?>
- Upload front-page.php to the my-templates folder and check your website, http://www.your-website.com/bbpress/ to see the results. It should start looking similar to your website now.
- If you want the sidebar to appear in your forum also, you will have to place <div id=”discussions”> into your WordPress theme’s content container on the front-page.php file, of course how you do that is dependent upon what theme you are using. For example, since <div id=”content”> is my theme’s container, I would arrange it like so in my front-page.php file:
<div id="content"> <div id="discussions">
- At the end, right before
<php get_footer(); ?>
add
<php get_sidebar(); ?>
and style it accordingly to your theme’s layout.
- After you upload front-page.php to your web server, check the layout in multiple web browsers to ensure it loads correctly. By now it should really look like a part of your theme’s layout.
- Make similar changes to: edit-post.php, favorites.php, forum.php, login.php, password-reset.php, profile.php, profile-base.php, profile-edit.php, register.php, register-success.php, search.php, tags.php, tag-single.php, topic.php, and view.php by replacing <php bb_get_header(); ?> to <php get_header(); ?> and <php bb_get_footer(); ?> to <php get_footer(); ?> and adding in <php get_sidebar(); ?> if you want a sidebar.
- The rest of the stuff will just need to be styled via the style.css in the my-templates folder. Make sure to remove any conflicting ids or classes from the BBPress stylesheet so as to not get W3C validation errors.
Mac OS X: Setting Up Apache, MySQL, PHP and Mod_Rewrite
Step 1: Enable Apache.
Go to System Preferences > Sharing and enable Personal Web Sharing. Verify that Apache has started by opening a browser and pointing it to http://localhost/.
Step 2: Install MySQL.
This is almost as easy as enabling Apache since MySQL has excellent support for Mac OS X.
Go to http://dev.mysql.com/downloads/ and pick out the latest OS X flavored package. Make sure to get the right one for your architecture. Mount the dmg and you should see two installer packages: one for the MySQL database, and the other installs the MySQL startup item.
The easiest thing to do is just run the standard installer for the database. It should be called something like mysql-standard-VERSION-apple-ETC.pkg. After that is installed, install the file MySQL.prefPane by double-clicking it. This is a panel in the System Preferences that allows you to start, stop and configure the database for automatic start.
Your database is installed. Look into the MySQL documentation if you want to secure it, because right now, the user name is root and there is no password.
Step 3: Install PHP.
Go to http://www.php.net/downloads.php and download the latest source version. You’ll want to put this in your directory (that’s my preference, at least), so open up a terminal:
cd /usr/local/src/ sudo fetch http://path/to/the/latest/download/from/php.net/ sudo tar zxvf php-VERSION-ETC.tar.gz cd php-VERSION
At this point you’re in the PHP source directory. We’ll now configure our PHP. NOTE: This example has the bare minimum of options to get this all working properly. See the PHP documentation for more configure options.
sudo make sudo make install sudo cp php.ini-dist /usr/local/lib/php.ini
Make sure to edit to your desired settings. Now we need to edit httpd.conf:
sudo open -a TextEdit /etc/httpd/httpd.conf
And make sure these lines are in their proper locations:
LoadModule php5_module libexec/libphp5.so # Should have been added already AddModule mod_php5.c # Should have been added already AddType application/x-httpd-php .php
Now restart Apache:
sudo apachectl graceful
And verify that the install worked by creating a file called test.php under your Sites directory (/Users/myusername/Sites/) with the following text:
<?php phpinfo(); ?>
Go to http://localhost/~myusername/test.php to verify that it worked.
Step 4: Enable mod_rewrite. (Optional)
Enabling mod_rewrite requires additional modification of the httpd.conf (and related) files so we can use .htaccess files.
sudo open -a TextEdit /etc/httpd/httpd.conf
Under this line:
<Directory "/Library/WebServer/Documents">
You’ll see:
AllowOverride None
Change this to:
AllowOverride All
You’ll also want to modify your user’s configuration file:
sudo open -a TextEdit /etc/httpd/users/myusername.conf
The Options directive must include FollowSymLinks, and the AllowOverride should be AuthConfig All. Example:
<Directory "/Users/myusername/Sites/"> Options Indexes MultiViews FollowSymLinks AllowOverride AuthConfig All Order allow,deny Allow from all </Directory>
Restart Apache and you’ll be able to use .htaccess files.
Project: ABC v3
In the next coming weeks I’ll be starting (again) and hopefully finishing more (finally) of a project that was started more than two years ago. Some of you may remember it from my days on Acura-CL.com (now AcuraZine) as abunchofcars.com (ABC).
The main purpose of the site is to create a nexus of Do-It-Yourself guides for anything related to cars. In the past we mainly concentrated on Acuras, specifically CL and TL and occasionally Honda Accords because those were forums that my friend and I frequented. We always had planned to expand it beyond, but never got around to finishing what we had.
My plan is to design the layout and code the structural architecture and allow other people to expand, edit, and moderate the content. My other friend, Dennis, will be co-admining ABC with me. I’ll have an online form in which interested persons can apply for contributor status and those who continue to provide exemplary support and assistance will be granted editor status. The difference between contributors and editors is that contributors can only submit for approval: articles, DIY guides, suggestions, etc.; whereas an editor can post live and approve what contributors submit. More on this as time goes on.
Head First HTML with CSS & XHTML
I’m always in search of a good CSS and XHTML book. Despite how many books on web design that one can find on Amazon.com, Barns and Noble, and/or other popular book stores, it is hard to beat Head First HTML with CSS & XHTML by Elisabeth and Eric Freeman. This book is very easy to read for beginners into CSS and XHTML and even a worthwile read for seasoned veterans.
I particularly like how the book is laid out. There are a total of 15 chapters with 658 pages including the index. The book utilizes a lot of color graphical examples to make a point. It has numerous examples, puzzles, and summaries at the end of the chapters to reinforce the concepts brought up. This book is catered to people who want to get started on applying CSS and XHTML immediately into their designs. They bring up a brief history and reasons why certain selectors are used and why without getting so much into the detail that would interest a person(s) who is studying web design as opposed to a person who just wants to create a CSS and XHTML page.
One of the best things I like about the book, besides quips of humor, is how they continually stress the importance of adhering to the World Wide Web Consortium (W3C) standards especially the emphasis on developing XHTML Strict pages. Most other books I have read do not stress the importance of web standards as Elisabeth and Eric do.
Concepts covered in the book are: three column layouts, two column layouts, positioning (absolute, relative, and fixed), headings, uses of list, styling font and layout, and much more. I find myself constantly refering back to this book for tips and tricks on my pages. I highly recommend it for anyone who is serious about CSS and XHTML.
Gallery 2.1 (Blackjack) Released and WordPress Gallery Integration Project
Very interesting! The new version of Gallery has just been released. Before I jump too much into that, let’s just recap what this means for Bui4Ever. Well since working on the redesign of Bui4Ever (v15, essentially the merging of content to WordPress), the next logical step would be complete integration of Gallery2 also. In Bui4Ever v14, the only part of the site that required any type of login was the Gallery. Now with WordPress, it has its own login for me to 1) write my posts and other admin stuff and 2) other people to comment. It would make no sense to require people to login in twice…so why not merge the two (WordPress and Gallery) logins. That brings us to WordPress Gallery2 Project. This will allow for users who register with WordPress to be autoregistered for Gallery2. One advantage that comes out of this is that a poster/contributor/editor/etc can be given rights to his or her subgallery and be able to post on Bui4Ever.
Now the biggest drawback of Gallery2 for me, for the longest time now, has been the slow load time. I have never been able to completely figure out that problem. I’ve seen other people’s Gallery2 load as quick as Gallery1, but yet mine and many others experience extreme lag. Supposedly Gallery Blackjack has some major changes to the core that will have “profound performance increase in most situations”. I am definitely excited about this!
For the time being, I’m going to create a whole new Gallery2 install (another URL change) because of one major unforeseeable flaw on my end: the WordPress and Gallery2 must share one single database to work. I do not know if I can successfully merge the existing Gallery2 database with the WordPress database. So to be on the safe side, I’ll create a whole new Gallery2 install and test it out and either one of two things will happen: 1) I import all the albums and data from the current Gallery2 install (www.bui4ever.com/pictures) and put it to the new Gallery2 install (www.bui4ever.com/wp-gallery2.php) or 2) I manage to learn (if even possible) to merge the existing Gallery2 install to the current WordPress database.
I’ll keep everyone posted on the progress of how this goes along with how I did it.