Converting BB Press 1.x attachments to BB Press 2.x

If you were using BB Press 1.x with the BB Attachments plugin it can be a bit of a challenge to re-attach them to BB Press 2.0 in Wordpress using the GD bbPress Attachments plugin.

Here are the steps I took to accomplish this migration.

1. Run the BB Press migration process making sure that both the original BB Press 1.x tables and Wordpress tables are in the same database.
2. Download the original attachments from the bb-attachments folder.
3. Switch Wordpress to not use year/month upload folders under Settings – Media.
4. Upload the attachments to the wp-content/uploads folder.
5. Install the GD bbPress Attachments plugin if you haven’t already.
6. Run the following MySQL script

INSERT INTO wp_posts
(post_author, post_date, post_date_gmt, post_content, post_title, post_status,
comment_status, ping_status, post_name, post_modified, post_modified_gmt,
post_parent, guid, menu_order, post_type, post_mime_type, comment_count)
SELECT replies.post_author, replies.post_date, replies.post_date_gmt,
SUBSTRING_INDEX(filename, '.', 1), SUBSTRING_INDEX(filename, '.', 1), 'inherit',
'open', 'open', CONCAT(bb_attachments.id,'.',SUBSTRING_INDEX(filename, '.', 1)),
replies.post_modified, replies.post_modified_gmt, replies.ID,
CONCAT('http://nonamers.org/wp-content/uploads/',bb_attachments.id,'.',filename) as guid,
0, 'attachment', mime, 0 FROM `bb_attachments`
JOIN bb_posts ON bb_posts.post_id = bb_attachments.post_id
JOIN bb_topics ON bb_topics.topic_id = bb_posts.topic_id AND bb_topics.topic_status = 0
LEFT JOIN wp_posts as topics ON topics.post_status = 'publish'
AND topics.post_type = 'topic' AND topics.post_title = bb_topics.topic_title
LEFT JOIN wp_posts as replies ON replies.post_parent = topics.ID
AND replies.post_status = 'publish' AND replies.post_type = 'reply'
AND replies.post_author = bb_posts.poster_id
AND replies.post_date_gmt = bb_posts.post_time
WHERE bb_attachments.status = 0 AND replies.ID IS NOT NULL

Tweak any attachments if necessary.

Fix for sorting in Job Manager Wordpress Plugin

If you want to sort jobs alphabetically in Job Manager and use sticky sort for highlighted items it will mess up the order of all non-highlighted opportunities. This was my quick workaround. Hopefully it will help someone.

In frontend-jobs.php

<?php
function jobman_sort_highlighted_jobs( $a, $b ) {
	$ahighlighted = get_post_meta( $a->ID, 'highlighted', true );
	$bhighlighted = get_post_meta( $b->ID, 'highlighted', true );
	if( $ahighlighted == $bhighlighted )
		return strnatcmp($a->post_title, $b->post_title);
	if( 1 == $ahighlighted )
		return -1;
	if( 1 == $bhighlighted )
		return 1;
	return strnatcmp($a->post_title, $b->post_title);
}
?>

NextGen Gallery – auto-detect gallery

By default the NextGen gallery for wordpress requires you select the gallery to display when you use the shortcode [nggallery id=1]. However, you may note in the gallery itself you’ve already specified the page where the gallery is to be displayed (”Page Link to:”). So why select the gallery in the shortcode when the database already has this information. This short bit of code will allow you to manage the association in the gallery itself and no longer have to use the id parameter.
Read more

Getting Wordpress Page IDs

Some Wordpress plugins and themes require you to supply a list of page ids. This brief video tutorial shows you how to get those IDs for a page or post.

Mary of ProVirtual Solutions suggested the Reveal IDs for WP-Admin plugin to help get the IDs .

Social Media on Your Website

There is plenty of advice online and success stories about large corporations using social media. If you are like me and are a small business owner, you likely don’t have a team of 100+ employees to go through all of the social media channels and monitor, tweet, post, etc. You could hire a social media company to help you with this if you are promoting a consumer product or service. Then again you could spend an hour a week promoting your business yourself. Either way, what does this mean for your website?
Read more

A Few of my Favorite Wordpress Plugins

Having built a few sites using Wordpress for a variety of different customers there are a few plugins that I keep using.

  • Akismet- Does not stop all spam comments, but certainly cuts down on them.
  • CForms – This is an amazing form builder and processor. The bloggers from delcious:days cook good code and good food. Download this from them directly rather than trying to install from within Wordpress.
  • Events Manager – Both a calendar and an event registration system. For simple community and organizational events this is all you need. Even integrates with Google maps.
  • ShareThis – A bit bulking on the amount of javascript code it produces, but a great way to encourage people to spread the word organically.

How to use Wordpress as a CMS

Wordpress Home PageWordpress can be used as a basic or advanced Content Management System (CMS) depending on how you set it up. In one particular case I setup Ron Christman Stone Masonry using Wordpress. Read on to see what plugins I installed and to view a brief guide on how to edit a Wordpress powered website.
Read more