Closed jessepearson closed 7 years ago
Thanks @jessepearson - I had another report of this in 576964-zd-woothemes with the following error:
PHP Fatal error: Call to a member function get_posts() on null in .../wp-content/plugins/woothemes-sensei/includes/class-sensei-wc-memberships.php on line 136
I couldn't reproduce, but a temporary solution is to disable the "Auto-start courses belonging to a membership" setting in Sensei > Settings > WooCommerce Memberships.
@pgk can you take a look when you get chance?
Actually the courses are auto-starting without this option checked - I did not have this checked (was likely added after I first set up Sensei and Memberships) and just went to look at this setting today, as I was unaware of this option. Customer this AM was confused by instructions on how to start the course from the My Account page - When switching to customer with User Switching Course is already started. I checked out for a course to verify this. Instead of the start course button, the button shown is Reset Course.
@danjjohnson Sorry for not including the error message, but that's the same one I was getting.
The work around you mentioned works. I believe it's simply due to there are no content restrictions in the membership plan purchased.
@danjjohnson @jessepearson
Fix on the PR above. I see why this might happen although I don't understand the domain logic behind returning a null restricted content.
It is ambiguous, does it mean we have no restrictions setup on that membership (which I think is edge-casey) or that we can access all content?
For the PR above I assume it's the first.
A wp_query with no results might have been a better indicator for the first case.
Reported in 574957-zd-woothemes.
This method call can return
null
if no content is found. If it does returnnull
, then there's a fatal error encountered in the nextforeach
loop.