Bug #2027
closedCAC Featured Content - fatal error on non-MS
0%
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!
Updated by Dominic Giglio about 12 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.
Updated by Boone Gorges about 12 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 :)
Updated by Dominic Giglio about 12 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.
Updated by Boone Gorges almost 12 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?
Updated by Dominic Giglio almost 12 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.
Updated by Dominic Giglio almost 12 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?
Updated by Boone Gorges almost 12 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.
Updated by Dominic Giglio almost 12 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.
Updated by Dominic Giglio almost 12 years ago
- Target version changed from 1.4.9 to 1.4.10
Updated by Dominic Giglio almost 12 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?
Updated by Boone Gorges almost 12 years ago
- Status changed from Assigned to Resolved
I can't reproduce the issue, so I guess we're good. Thanks, Dom.