UUA Services Plugin error

By Chris W. Jordan
May 22, 2022, 2:39 pm EDT

Recently I started seeing the error below from the UUA Services Plugin. I didn't change anything, and I can't reproduce it on my local webserver, so presumably the hosting provider (aplus.net) changed something. At any rate, the error is:

Warning: require_once(widgets/class-uua-widget-featured-service.php): failed to open stream: No such file or directory in uua-widget-functions.php on line 14

Fatal error: require_once(): Failed opening required 'widgets/class-uua-widget-featured-service.php' (include_path='.') in uua-widget-functions.php on line 14

 The line of code triggering the error is:

require_once 'widgets/class-uua-widget-featured-service.php';

I tried changing that to:

require_once __DIR__ . '/widgets/class-uua-widget-featured-service.php';

to try and force it into the correct directory, which didn't work, and gave the error:

Warning: require_once(/services16/webpages/util/s/e/sedonauu.site.aplus.net/public/wordpress/wp-admin/widgets/class-uua-widget-featured-service.php): failed to open stream: No such file or directory in uua-widget-functions.php on line 14

Fatal error: require_once(): Failed opening required '/services16/webpages/util/s/e/sedonauu.site.aplus.net/public/wordpress/wp-admin/widgets/class-uua-widget-featured-service.php' (include_path='.') in uua-widget-functions.php on line 14

so looks like the magic constant __DIR__ is expanding into the path to wp-admin for some reason. No idea why.

Anyway, I changed that line (and the following one) to:

require_once dirname( UUAS_PLUGIN_FILE ) . '/includes/widgets/class-uua-widget-featured-service.php';
require_once dirname( UUAS_PLUGIN_FILE ) . '/includes/widgets/class-uua-widget-upcoming-services.php';

Which works fine. That should also work fine on other sites, although I haven't tested it. It might be a reasonable change to make to the plugin, to prevent the problem from happening for anyone else. After all you already went to the trouble to define UUAS_PLUGIN_FILE earlier in the code, you may as well use it.

Anyway, the above works for me. If anyone more skilled with PHP than I am can suggest why the original line broke in the first place, I'd be interested in any ideas (although I'm not planning on playing with it much more).

Comments (2)

I had a similar error with a different plugin (List Category Posts), which I had posted last week in the Facebook group UU Website lab (https://www.facebook.com/groups/uuwebsitelab).

I've tried going back to a previous version of Wordpress (5.7.2) and I still get the error. I found another plugin (SmartPostShow) that accomplishes what I want so I've switched to that.

I see that Chris Jordan is using the same host I am (aplus.net). I hadn't been using the UUA Services plugin but I was wanting to finally try it out so I'm glad to learn of this workaround.

Also been contemplating a change in hosts as this isn't the first time aplus.net has changed something on their end that caused problems.

Mariann,

That's interesting, since I do also use List Category Posts on that site, and did not see an error with that. The UUA Services error also occurs with all other plugins turned off, so I don't think it could be a plugin conflict.

Thanks for letting me know about the UU Website lab Facebook group. I didn't know that was there.