Fatal Error When Featuring Listings

Hi Ihor,

thanks, that worked, but now we have another issue:

I’m running into another fatal error, this time related to the featuring functionality in Memberships 2.2.0.

Setup:

  • HivePress 1.7.23 (latest)
  • Memberships 2.2.0 (latest)
  • WordPress 6.x
  • PHP 8.x

Steps to reproduce:

  1. Create a Membership Plan with Featuring Limit set to 1 (or any number) and Featuring Period set to 30
  2. Assign a WooCommerce product to the plan
  3. Purchase the membership as a vendor (order status: Processing/Completed)
  4. Membership activates successfully (vendor receives “Membership Activated” email)
  5. Go to vendor dashboard → Listings
  6. Click the star/feature icon on any listing
  7. Fatal error occurs immediately

Error:
Fatal error: Uncaught TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, array callback must have exactly two members in wp-content/plugins/hivepress/includes/components/class-router.php:674

Full stack trace:
call_user_func(Array) in class-router.php(674)
HivePress\Components\Router->set_page_template() in class-wp-hook.php(341)
apply_filters(‘template_include…’) in plugin.php(205)
template-loader.php(114)

The membership itself activates correctly - the vendor gets the email and the plan shows as active. It’s only the featuring action that causes the crash.

Could you please look into this? We’d like to offer featuring as part of our membership plans but can’t launch it with this error.

Thanks!

Hi Ivan,

I hope you don’t mind that I’ve created a new topic. We aim to keep the forum well-structured and organized, so for longer discussions, it’s better to have them in a separate thread. If it turns out to be a bug, I’ll move it to the Bug Reports category.

I’ve tried to reproduce the issue locally, but wasn’t able to do so: Featuring Listings with Memberships Update | Loom [if I missed something, please let me know].

Have you tried disabling any custom code snippets to rule out conflicts? Additionally, have you tried to test only with Memberships and HivePress? If so, and the issue persists, please send temporary WP access to support@hivepress.io with the link to this topic, and we’ll check it (please send only the link, without login and password). You can create a temporary access link using this plugin.

1 Like

Hi Kseniia,

Thank you for looking into this. We’ve found the root cause.

The issue is a conflict between the built-in Listing Packages module and the Memberships extension. Both register the listing_feature_complete_page route with their own action and redirect callbacks. When HivePress merges them via merge_arrays, it concatenates the arrays instead of one overriding the other, resulting in a 4-element array like this:

[action] => Array
(
    [0] => HivePress\Controllers\Membership Object
    [1] => render_listing_feature_complete_page
    [2] => HivePress\Controllers\Listing_Package Object
    [3] => render_listing_feature_complete_page
)

call_user_func() on line 674 of class-router.php expects exactly 2 members ([$object, 'method']), so it throws a fatal error.

This explains why you couldn’t reproduce it - you likely tested with Memberships only, without the Listing Packages module active. On our setup both are present.

We’ve applied a temporary workaround - a filter on hivepress/v1/routes (priority 1000) that trims the arrays back to 2 elements, keeping only the Memberships callbacks:

php

add_filter('hivepress/v1/routes', function($routes) {
    if (isset($routes['listing_feature_complete_page']['action']) && is_array($routes['listing_feature_complete_page']['action']) && count($routes['listing_feature_complete_page']['action']) > 2) {
        $routes['listing_feature_complete_page']['action'] = [
            $routes['listing_feature_complete_page']['action'][0],
            $routes['listing_feature_complete_page']['action'][1],
        ];
    }
    if (isset($routes['listing_feature_complete_page']['redirect']) && is_array($routes['listing_feature_complete_page']['redirect']) && count($routes['listing_feature_complete_page']['redirect']) > 2) {
        $routes['listing_feature_complete_page']['redirect'] = [
            $routes['listing_feature_complete_page']['redirect'][0],
            $routes['listing_feature_complete_page']['redirect'][1],
        ];
    }
    return $routes;
}, 1000);

This works, but it’s not ideal as a permanent solution. Could this be addressed in a future update so the Memberships extension properly overrides the Packages route callbacks?

Update - second issue discovered:

After fixing the fatal error, we tested the featuring flow end-to-end. When a vendor features a listing through the Memberships plan (Featuring Limit: 1, Featuring Period: 30), hp_featured is set to 1 successfully. However:

  • Featuring Date and Expiration Date remain empty in the listing edit screen

  • No hp_featured_time or expiry-related meta is saved in post meta

  • No Action Scheduler task is created for the featuring expiry

This means the listing stays featured permanently and never auto-expires, even though the membership plan has a Featuring Period of 30 days configured.

Tested on staging with HivePress 1.7.23 and Memberships 2.2.0.

:red_exclamation_mark: Update 2 - resolved the fatal error, found new issue with featuring limit:

We resolved the fatal error by deactivating the Paid Listings extension. It turns out Paid Listings was overriding the Memberships featuring logic and also causing the route conflict (the 4-element array issue we described earlier). With Paid Listings deactivated, the route fix snippet is no longer needed and Memberships correctly blocks featuring for vendors without a plan - they get redirected to the plans page as expected.

However, we discovered a new issue: the Featuring Limit is not enforced.

Steps to reproduce:

  1. Create a membership plan with Featuring Limit: 1 and Featuring Period: 30

  2. Purchase the plan as a non-admin vendor

  3. The membership is created correctly with Featuring Limit showing as 1

  4. Feature one listing - works, limit decreases to 0

  5. Attempt to feature a second listing - it succeeds and the listing becomes featured, even though the limit is 0

Expected behavior: the second featuring attempt should be blocked since the limit has been reached.

Tested on HivePress 1.7.23 and Memberships 2.2.0 with Paid Listings deactivated.

Could this be looked into as well?

Thanks! Ivan

Hi Ivan,

Thanks for the update.

Since the Memberships plugin was designed as an advanced version of Paid Listings, we recommend keeping only one of these plugins active to avoid potential conflicts. Paid Listings will continue to receive compatibility updates, but no new features are planned for it.

Regarding the featuring limit, please make sure you are testing this with a regular vendor account and not an admin account. Admins do not have any limits and can feature an unlimited number of listings. I tested this using a regular vendor account and wasn’t able to reproduce the issue, whereas with an admin account I was able to feature as many listings as I wanted, despite the limit of 1 feature.

As for the featuring and expiration date, please also ensure that the membership is assigned to a regular vendor rather than an admin. As mentioned earlier, admin accounts have unrestricted access, so limits and expiration rules may not apply to them.

If the issue still persists, please let me know and we’ll investigate further. Before releasing the update, we tested as many scenarios as possible, but there is always a chance that something may have been missed.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.