wpmudev / membership-2

GNU General Public License v2.0
48 stars 58 forks source link

Membership 2 fails on WP 5.8 (Solved) #12

Closed BassGPS closed 3 years ago

BassGPS commented 3 years ago

Don't have a solution yet but the protected content page delivers a critical error. WP 5.7.2 working correctly.

jdagan commented 3 years ago

SAME for me. Failed on WP 5.8

Squid486 commented 3 years ago

Same thing here. I tried adding the disable block widgets plugin and/or disabled Gutenberg with no luck. I believe it's something with the wp-includes/template.php file.

sainty0 commented 3 years ago
public function custom_page_template( $default_template ) {
    $template = '';

    // Checks for invoice single template.
    if ( $type = MS_Model_Pages::is_membership_page() ) {
        $membership_id = apply_filters(
            'ms_detect_membership_id',
            0,
            true,
            true
        );

        if ( $membership_id ) {
            $template = get_query_template(
                'm2',
                array('m2-' . $type . '-' . $membership_id . '.php')
            );
        }

        if ( ! $template ) {
            $template = get_query_template(
                'm2',
                array('m2-' . $type . '.php')
            );
        }
    }

    if ( ! $template ) {
        $template = $default_template;
    }
    return $template;
}

Edit this function around line 964 of the class-ms-controller-plugin.php. This can be found in wordpress > htdocs > wp-content >plugins > membership2-2-master > app > controller > class-ms-controller-plugin.php. The issue was that get_query_template requires an array for the second param in 5.8.

I would send a merge request but I am unsure if this project is still maintained or not.

BassGPS commented 3 years ago

@sainty0 You are the Man! This solved the issue for me. I just didn't have the time available right now to devote to this investigation. I hate to say that I might still be looking for an alternative as we get farther and farther away from the last commit on this project but this will buy me some time. Thanks again and best wishes! Marking this as successfully resolved.

jdagan commented 3 years ago

Are you going to commit this change? Thanks.

jdagan commented 3 years ago

send a merge request

Please send a merge request

sainty0 commented 3 years ago

Hey jdagan I've submitted a pull request. You can either use that or just follow the steps on my comment above. It a pretty easy fix. Good luck.

offthewallsocial commented 3 years ago

This was the fix I needed. Thanks so much!