Membership 2 error shown in the default membership overview

Dear people of WPMUDEV,

Getting the error below with Membership 2, a little worried it may not be working properly and what is underlying this error. Thank you for checking this out!

Cheers.

Sandra :slight_smile:
Just installed your great membership plug in but getting this error:

(error below is shown in the default membership overview)

Fatal error: Uncaught Error: Call to a member function get_subscription() on null in /home/gulheid3/public_html/lvdev1/wp-content/plugins/membership/app/view/membership/overview/class-ms-view-membership-overview-simple.php:262 Stack trace: #0 /home/gulheid3/public_html/lvdev1/wp-content/plugins/membership/app/view/membership/overview/class-ms-view-membership-overview-simple.php(162): MS_View_Membership_Overview_Simple->members_panel_data(Array, 120) #1 /home/gulheid3/public_html/lvdev1/wp-content/plugins/membership/app/view/membership/overview/class-ms-view-membership-overview-simple.php(295): MS_View_Membership_Overview_Simple->members_panel() #2 /home/gulheid3/public_html/lvdev1/wp-content/plugins/membership/app/view/membership/overview/class-ms-view-membership-overview-simple.php(92): MS_View_Membership_Overview_Simple->available_content_panel() #3 /home/gulheid3/public_html/lvdev1/wp-content/plugins/membership/app/core/class-ms-view.php(127): MS_View_Membership_Overview_Simple->to_html() #4 /home/gulheid3/public_html/ in /home/gulheid3/public_html/lvdev1/wp-content/plugins/membership/app/view/membership/overview/class-ms-view-membership-overview-simple.php on line 262

What we want is to hide several pages from users who haven't logged in (yet) and require users to register for a WP account, these pages shown be visible for all logged in users (not requiring a specific membership). Is this the way to do it?

Many thanks!

Sandra :slight_smile:

  • Adam Czajczyk

    Hello Sandra,

    I hope you're well today and thank you for your question!

    What we want is to hide several pages from users who haven't logged in (yet) and require users to register for a WP account, these pages shown be visible for all logged in users (not requiring a specific membership). Is this the way to do it?

    Yes, you can absolutely do it with Membership 2 Pro plugin but you would want to create a "Guest" membership to achieve it (the membership of type "guest" instead of "standard":wink:.

    The "default" membership covers automatically all the logged in users who are not members of other memberships.

    The "guest" membership covers all the visitors that are not logged in to the site (so these would be not registered visitors but also registered users - both members of some membership(s) and non-members - who are currently not logged in to the site).

    As for the error in question.
    You have enabled support access to the site so I used it to access it and check. I could see the error but I also noticed that the Membership 2 Pro plugin was set to a "test Membership" mode. This mode is for site admins (who are by default excluded from all memberships as they can access everything) to be able to check how the protection works for different memberships.

    However, this mode should be used for testing only and should be turned off during normal usage. A typical use scenario is for example:
    - you set some page to be enabled for members of two memberships
    - you open that page as an administrator and you got access to it
    - you turn on "Test Mode" and switch to different memberships to see if the page is available or not
    - after testing you exist test mode.

    If the test mode is active on back-end, especially on Membership 2 Pro settings/configuration pages, it might lead to unexpected results.

    I have disabled it for now but whenever you deal with it, make sure that when you're finished with testing, you switch it off. If the error in question shows up again, look at the top of the page and use "Exist simulation" to switch off the test mode:

    Best regards,
    Adam

  • Adam Czajczyk

    Hello Sandra!

    we do want the Member pages for logged-in users only, so I assume we need default membership not guest membership for this? These pages should not be visible for users not logged in.

    Ah, you're right then. I'm sorry, I misunderstood you initially. Yes, you do need "default" membership then. if you assign it to any of the pages (in "Membership 2 -> Protection Rules"), that page will be visible only to logged in users and visitors (not logged in) will instead see protection message and a login form.

    Note please: even if protected with default membership, this page will still be visible to admins (because they are excluded from any memberships and always have access to everything).

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.