Bring over permission level from WordPress MemberPress

The basic idea makes sense. current_user_can is a WordPress function. Its documentation is here. I think that in this case you are fine to call it without the $object_id argument. If MemberPress adds mepr-active as a role or capability to users when they sign up for any membership level, and removes the mepr-active role or capability when the membership expires, then it will do what you are looking for.

Be careful with the comment (// Don't use spaces between names.). Comments in that form need to be included on a single line, or they will cause an error. You can remove the comment from the code.