Category Archives: WordPress

I recently discovered the “themia” theme from InkThemes. It’s been a perfect starting point for one of my customers.

As I was setting things up, I prototyped it on my server (like I always do) and it looked great.

Then I installed the them on the production site and noticed there was an upgrade for the theme, so I ran it. Lo and behold, the menus on the top weren’t working.

Since I can be pretty scattered about changes; and because modifying a theme to support WordPress’ built-in menus has become second-hand to me, I thought maybe I had forgotten doing that step. But no, that wasn’t the case. In fact, when I upgraded my test site, the problem appeared there as well.

Luckily, the guys over at InkThemes are a great (and responsive) bunch. Even using their free support, I got an answer in under 24 hours, which you can find here.

But the upshot is that one word reversal in their function code made all the difference in the world.

If you are experiencing this issue, find the line that reads:

add_action('after_theme_setup', 'inkthemes_register_custom_menu');

…and change it to…

add_action('after_setup_theme', 'inkthemes_register_custom_menu');

One of my customers alerted me to the fact that permalinks (such as the “recent posts” section on the sidebar) weren’t working on a sub-blog on their multisite installation. Instead they got a “Page not found” error.

I did a quick bit of poking around and found that none of the permalinks on any of the sub-blogs were working. If I hard-coded a non-permalink URL (http://www.thesite.com/sub-blog1/?p=123, where “123” was an actual post ID) then I could get to the post just fine.

This seemed like a straightforward problem, but “wordpress multisite permalink” didn’t give me an immediate hit. It took a little digging before I found this post. And even then, the solution was hinted at way at the bottom of the thread.

Did you activate the plugin for each site?
Have you resaved permalinks on the subsite?

Well, I didn’t have a plugin that I thought was the culprit. But saving the permalinks on the site?

I checked one of the sub-sites and permalinks were set correctly. BUT, I’ve seen stranger things in 23 years, so I hit “Save Changes” on the permalinks page anyway.

Well what do you know? It worked.

Not going to ask why or how. Just tucking this one away for the future and moving on with my life.

The Problem
I’ve got a client with a multi-site installation of WordPress, who decided they needed to email both newsletters and individual blog posts not only from the main site, but from each sub-site as well.

MailPress seemed like the best choice, so I went with it. Installing and (Network) activating the plugin went fine. Setting up the main site went fine. Activating the customized MailPress theme (which was consistent across all sites) went fine.

But when I went to add users, I just flat-out couldn’t. I saw the bulk-add box, but nothing else, even after I bulk added a couple of addresses.

The Cause
For whatever reason, MailPress created it’s special tables for the main site, but not for the sub sites. These tables included mailpress_users which (as you might guess) hold the subscribed user names.

A Bit of Background
Wordpress multisite takes all the main tables (wp_options, wp_users, etc) and – for the subsites – adds a number. So your first subsite gets wp_2_options, wp_2_users, etc.

MailPress keeps that going but tagging the site prefix onto it’s tables. Instead of mailpress_forms, mailpress_users, etc you get wp_2_mailpress_forms, wp_2_mailpress_users, and so on.

Deep in the heart of the MailPress installation there’s a file /wp-content/plugins/mailpress/mp-admin/includes/install/mailpress.php. And in that file it indicates which tables should be created (or upgraded). I couldn’t figure out what file is supposed to actually launch install/mailpress.php, but it doesn’t matter, the commands to create the required tables were there, so I just pulled them out as you see below.

The Solution
If you are having this problem, open your favorite MySQL query tool (it’s probably phpAdmin, and you probably launch it from your hosts control panel. And let’s face it – if you don’t know what I’m talking about at this point, the better part of valour is to find someone who IS comfortable with MySQL and queries.

I even know this guy I’d recommend – his rates are pretty reasonable.

Use the code below, changing wp_2_ to the number of each of your sites until the table are all created.


CREATE TABLE wp_2_mailpresss_mails (
id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
status enum('draft', 'unsent', 'sending', 'sent', 'archived', '') NOT NULL,
theme varchar(255) NOT NULL default '',
themedir varchar(255) NOT NULL default '',
template varchar(255) NOT NULL default '',
fromemail varchar(255) NOT NULL default '',
fromname varchar(255) NOT NULL default '',
toname varchar(255) NOT NULL default '',
charset varchar(255) NOT NULL default '',
parent bigint(20) UNSIGNED NOT NULL default 0,
child bigint(20) NOT NULL default 0,
subject varchar(255) NOT NULL default '',
created timestamp NOT NULL default '0000-00-00 00:00:00',
created_user_id bigint(20) UNSIGNED NOT NULL default 0,
sent timestamp NOT NULL default '0000-00-00 00:00:00',
sent_user_id bigint(20) UNSIGNED NOT NULL default 0,
toemail longtext NOT NULL,
plaintext longtext NOT NULL,
html longtext NOT NULL,
PRIMARY KEY (id),
KEY status (status)
);

CREATE TABLE wp_2_mailpresss_mailmeta (
meta_id bigint(20) NOT NULL auto_increment,
mp_mail_id bigint(20) NOT NULL default ‘0’,
meta_key varchar(255) default NULL,
meta_value longtext,
PRIMARY KEY (meta_id),
KEY mp_mail_id (mp_mail_id,meta_key)
);

CREATE TABLE wp_2_mailpresss_users (
id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
email varchar(100) NOT NULL,
name varchar(100) NOT NULL,
status enum(‘waiting’, ‘active’, ‘bounced’, ‘unsubscribed’) NOT NULL,
confkey varchar(100) NOT NULL,
created timestamp NOT NULL default ‘0000-00-00 00:00:00’,
created_IP varchar(100) NOT NULL default ”,
created_agent text NOT NULL,
created_user_id bigint(20) UNSIGNED NOT NULL default 0,
created_country char(2) NOT NULL default ‘ZZ’,
created_US_state char(2) NOT NULL default ‘ZZ’,
laststatus timestamp NOT NULL default ‘0000-00-00 00:00:00’,
laststatus_IP varchar(100) NOT NULL default ”,
laststatus_agent text NOT NULL,
laststatus_user_id bigint(20) UNSIGNED NOT NULL default 0,
PRIMARY KEY (id),
KEY status (status)
);

CREATE TABLE wp_2_mailpresss_usermeta (
meta_id bigint(20) NOT NULL auto_increment,
mp_user_id bigint(20) NOT NULL default ‘0’,
meta_key varchar(255) default NULL,
meta_value longtext,
PRIMARY KEY (meta_id),
KEY mp_user_id (mp_user_id,meta_key)
);

CREATE TABLE wp_2_mailpresss_stats (
sdate date NOT NULL,
stype char(1) NOT NULL,
slib varchar(45) NOT NULL,
scount bigint NOT NULL,
PRIMARY KEY(stype, sdate, slib)
);