Getting Cimy Extra user Fields working in WordPress MU

One of the projects I’m working on is a community-based blog system. Because of what I’m trying to accomplish, I have a need to add extra fields to my user’s profile information. Without giving anything away, I need a profile picture, some information on what organization my members belong to, state, and a few other pieces of information from each user to realize the vision I had when I started piecing this project together.

While it is completely possible to go in and hack the core files of WordPress MU to give me the functionality I need, I’d be giving up the ability to upgrade easily on the next release cycle, and for me, that’s just not an option. If at all possible I don’t want to mess with the core files at all.

Cimy Extra User Fields provides all of this functionality and a lot more. Unfortunately, it doesn’t come out of the box as a WordPress MU capable plugin. After looking around a bit, I found that it could be adapted, and I’ve done so, though not to the level I’d like… Just yet.

In the standard WordPress install, Cimy not only adds fields to the user profile, but it also adds those fields to the registration process, along with a customized registration. So far I haven’t gotten this to work with MU, but I haven’t given up yet! I’ll be hitting the WPMU dev forums later to see if I can isolate this, as it would be convenient to add at least two or three of those pieces of information to the initial registration.

The conversion to MU is quite simple, at least as of version 0.99. Part of the process requires “mu-ifying” the way cimy puts data in the database. This prevents the plugin from adding the custom field tables to each and every blog in your WordPress MU setup, and replaces that data with a dingle, global table.

Open cimy_user_extra_fields.php and find the lines that read:

//$wpdb_data_table = $wpdb->prefix."cimy_data";
//$wpdb_fields_table = $wpdb->prefix."cimy_fields";

replace them with the following:

//$wpdb_data_table = $wpdb->prefix."cimy_data";
//$wpdb_fields_table = $wpdb->prefix."cimy_fields";
$wpdb_data_table = "wp_cimy_data";
$wpdb_fields_table = "wp_cimy_fields";

So far, pretty easy. But even if the plugin is active, you’ll never see it. Scroll down to line 323 or so, and look for the following:

function cimy_admin_menu_custom() {
global $cimy_uef_name, $cimy_uef_domain;

add_options_page($cimy_uef_name, $cimy_uef_name, 10, basename(__FILE__), 'cimy_admin_define_extra_fields');
add_submenu_page('profile.php', __('Authors & Users Extended', $cimy_uef_domain), __('A&U Extended', $cimy_uef_domain), 10, basename(__FILE__), 'cimy_admin_users_list_page');
}

Modify the code so that it looks like this:

function cimy_admin_menu_custom() {
global $cimy_uef_name, $cimy_uef_domain;
if (is_site_admin()) {
add_options_page($cimy_uef_name, $cimy_uef_name, 10, basename(__FILE__), 'cimy_admin_define_extra_fields');
add_submenu_page('profile.php', __('Authors & Users Extended', $cimy_uef_domain), __('A&U Extended', $cimy_uef_domain), 10, basename(__FILE__), 'cimy_admin_users_list_page');
}
}

Notice the change? You’ve just instructed the plugin to be vieable only by the WPMU admin user. Thant way it won’t show for anyone else but the site administrators. (and to be honest, it won’t show up at all without it.)

Upload the plugin to your mu-plugins folder and see what happens…

Most likely, nothing at all. That’s OK. Wordpress MU global plugins aren’t ever given the activation signal, so the plugin probably hasn’t created its database tables yet. The simple workaround for this is to move the entire plugin folder from mu-plugins to plugins, go to the plugins administration panel, activate it, then immediately move the plugin back to mu-plugins. The tables will be created and the plugin should work fine. It did for me, at least.

I’d like to thank Marco Cimmino for some excellent work on this plugin. It really is one of the most complex and powerful I’ve seen for WordPress to date, with the exception of things like OWA.

*NOTE: In Googling around to see if anyone else had found solutions for this, I came across an archived IRC conversation between some developers on wpmu that leads me to believe that Marco may have a fully Wordpress MU capable version of Cimy Extra User Fields available very soon. If so, this particular puppy is going to be one very happy camper. Until then, I’ll still be working on a way to get the registration info to show.


Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically each day to your feed reader. If you don't have a feed reader, you can always have these articles delivered to your email inbox every day. Click here to sign up.

Trackbacks & Pingbacks

No trackbacks/pingbacks yet.

Comments

Hi,
I’m the author of the plug-in, some things to say:

1) My last name is “Cimmino” not “Crimmino” ;)
2) Thank you for your interest in the plug-in
3) Cimy User Extra Fields 1.0.0 is under heavy development and A LOT is changed since 0.9.9, however MU support probably will not hit 1.0.0

This because the very lack of documentation about MU and how it works and also because there are some difficulties, like this:
when you register under MU the registration will not be registered immediately, but hit first the “waiting room” until it’s confirmed by the registrant, this is a complication for my plug-in because should stay in a “limbo” for some time and then decide to delete it when and if it’s discarded by MU.

This is not so simple and also totally undocumented!
So if someone would sponsor me some hours to investigate more can be helpful, I read a lot of people ready to thanx me for the plug-in and to ask MU support, but very few give me support sponsoring my work or even translation.

From the time 0.9.9 is out only two translations appeared, and one (German) only because I helped the girl who translated it in some small configurations.

So I thanks all of you, but sometimes (not you in particular) try to help people and not only ask and wait for free work.

thanks for the attention
Marco Cimmino

Marco,

Sorry for the misspelling. It’s been corrected. ;)

I’m in the middle of a ton of projects right this moment (finding all of the hard coded German in this template, for one!), but I’ll be happy to do what I can to assist.

Again, thank you for the wonderful work you’ve done. Of all the plugins of this nature I’ve seen, yours is by far the best

Hi Jerry,

Any luck with this yet? I’m in desperate need to add ne extra field to the registration form and I thought this plugin would svae me - guess not :\

To be honest, my attentions have been focused on other issues for the past few weeks. I’m getting ready to launch updated versions of several websites, and I just don’t have time to try to find the hooks in the mu code right now.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>