Fatal error when trying to create a new instance of M_Membership

I'm writing a plugin that has some custom rules. I'm needing to be able to manage the user level through the move_level function.

I've included the class that i'm using / making in the lower portions of this message.

The issue is I'm receiving the following error inside my class. I'm trying to at the end of the day tie into the method move_level which is in the class.membership.php file.


Fatal error: Class 'M_Membership' not found in .../wp-content/plugins/bac-plugin/classes/BeefAdvocateManageManageUser.php on line 25

Fatal error: Call to a member function get_queried_object() on a non-object in .../wp-includes/query.php on line 42


include_once plugins_url() . '/membership/membershipincludes/classes/class.membership.php';

class BeefAdvocateManageUser {

function __construct() {

add_filter("login_redirect", array($this, "login_redirect"), 10, 3);

$this->moveusertolevel(3, 3);


public function moveusertolevel($user_id, $to_level_id) {

$member = new M_Membership($user_id);


// $member->move_level($from_level_id, $to_level_id );


public function addusertolevel($user_id, $level_id) {

$member = new M_Membership($user_id);


public function addusertosub($user_id, $sub_id) {

$member = new M_Membership($user_id);


function login_redirect($redirect_to, $request, $user) {

//is there a user to check?
global $user;
if (isset($user->roles) && is_array($user->roles)) {

//check for admins
if (in_array("administrator", $user->roles) || in_array("editor", $user->roles)) {

// redirect them to the default place
return home_url() . "/wp-admin/";

} else {

return home_url() . "/learn/";


} else {

return $redirect_to;