Project

General

Profile

Actions

Bug #2027

closed

CAC Featured Content - fatal error on non-MS

Added by Boone Gorges over 11 years ago. Updated over 11 years ago.

Status:
Resolved
Priority name:
High
Assignee:
Dominic Giglio
Category name:
WordPress (misc)
Target version:
Start date:
2012-08-08
Due date:
% Done:

0%

Estimated time:
Deployment actions:

Description

I noticed a fatal error when I tried selecting a featured Member on a non-MS installation of WordPress: it turns out that the function get_user_id_from_string() is Multisite-only.

This is a good opportunity to go through the plugin and make sure that there aren't other places where it dies on non-MS. Obviously, the Blog bit should not appear. Ideally, the Post section would degrade gracefully, so that the Blog field disappears and posts are automatically pulled from the main blog. At the very minimum, these sections should be disabled all together if ( !is_multisite() ), just to avoid fatal errors.

As for the specific case of get_user_id_from_string(), it would be a real shame the Members featured content type didn't work just due to MS vs non-MS. A simple solution is, in a utility file, do the following:

if ( !function_exists( 'get_user_id_from_string' ) ) {
    function get_user_id_from_string( $string ) {
        // just copy WP's function - I don't think there's anything particularly MS-specific about it
    }
}

I'm marking this ticket High because it really is a must-have before launching the plugin publicly - definitely don't want to start crashing people's sites!

Actions #1

Updated by Matt Gold over 11 years ago

Nice catch, Boone. Thank you.

Actions #2

Updated by Dominic Giglio over 11 years ago

Boone,

To address this issue I copied the cac-featured-content plugin folder into the SVN repo I was using for the profile fields issue. This allowed me to see how the plugin works on a fresh WP/BP install without MS enabled. There were quite a few places where the code needed to be strengthened and adjusted to handle the change.

I won't list all the details here because I'm sure you have an idea of what parts of the plugin may have been susceptible. I'll just say that I altered the admin interface to only show featured_blog related info when running MS. And then altered the way in which the controller code loads its info according to the existence of MS features.

I've pushed all the changes up to the featured-content branch. Take a look and let me know if you spot anything I missed. If it looks good to you I think we can close this.

https://github.com/castiron/cac/commits/featured-content

Actions #3

Updated by Boone Gorges over 11 years ago

  • Status changed from Assigned to Resolved

The changes look good, Dom. Thanks for making them!

I'll go ahead and merge the latest version of the plugin back into the production branches, but in the future it would be nice to handle that via the WP plugin updater, which implies that the plugin is hosted in the wordpress.org repository. Nudge :)

Actions #4

Updated by Dominic Giglio over 11 years ago

HaHa! I felt that nudge. :-)

While working on this issue I was thinking that I should just take the time now to knock out the last few issues and get this plugin deployed properly. Since I'm planning on making up this week's missed hours next week, I will make sure to focus on that.

Actions #5

Updated by Boone Gorges over 11 years ago

Thanks, Dom!

Actions #6

Updated by Boone Gorges over 11 years ago

  • Status changed from Resolved to Assigned

Hi Dom - I'm reopening this issue because of CBox. We're pulling in CAC Featured Content as an auto-installed plugin, and setting up the widget as an auto-installed widget. But this problem is cropping up with version 1.0.0, which is the latest version in the wordpress.org repo. Would you mind pushing a bugfix release to wordpress.org with this fix?

Actions #7

Updated by Dominic Giglio over 11 years ago

  • Category name set to WordPress (misc)
  • Target version changed from Not tracked to 1.4.9

Since I have #2174 (domain mapping support) slated for 1.4.9 as well, I'll work on both of these issues together.

Actions #8

Updated by Dominic Giglio over 11 years ago

What exactly is the bug you're experiencing on CBox? Is it related to the original description: you can't select members? Or are the blogs/posts dropdowns not degrading properly?

Actions #9

Updated by Boone Gorges over 11 years ago

The problem I experienced was with member selection (got a fatal error), but it's probably just because I was testing the Members widget. You should activate the widget on non-MS and run through the different content types, to make sure that they all work.

Actions #10

Updated by Dominic Giglio over 11 years ago

Just wanted to give you a quick update on this issue. I restarted my ms vs non-ms testing so I didn't have any old code tweaks or stale cache info laying around. I completely reinstalled an entirely blank local env. Downloaded WP (3.4.2) installed CFCW from plugin admin page and then installed BP from scratch (also thru admin). At this point I had everything but MS running. The widget seemed to work fine. It excluded the "Blog" content type and when I chose myself as the featured member [ because I am you know :-) ] I received no errors.

I then enabled multisite and went through all the setup and config and the widget updated accordingly. It immediately displayed the "Blogs" content type and still displays a featured member with no problems. So at this point I'm moving over to try and finish the Domain Mapping issue (#2174) to try and sneak it into 1.4.9. I'm having a little trouble generating the correct URL but I'll figure it out.

I think what I'll do next is install a new local env and install CBox. Then do all the testing outlined above again. I'll try and update the commonsinabox.org docs wherever I can as I learn about how the CBox process works.

Actions #11

Updated by Dominic Giglio over 11 years ago

  • Target version changed from 1.4.9 to 1.4.10
Actions #12

Updated by Dominic Giglio over 11 years ago

Boone,

I've installed CBox. Man what a slick process! You and Ray (and PressCrew) really out did yourselves!! I'm heading over to the Github issues page to chime in right after this update.

I don't seem to be having any issues with member selection in cfcw. It appears to be working on my CBox install and my separate MS and Non-MS test env. What do you mean by:

probably just because I was testing the Members widget

Is that a different plugin/widget that I should check out to make sure my code (or its) isn't in conflict?

Actions #13

Updated by Boone Gorges over 11 years ago

  • Status changed from Assigned to Resolved

I can't reproduce the issue, so I guess we're good. Thanks, Dom.

Actions

Also available in: Atom PDF