Check if MemberPress exists before add_action call

Since I do not have access to the plugin to confirm I’ll use generic info and updated my answer since I was using the demo they had in their docs. This works in the functions file or on the frontend.

// check for plugin using plugin name
if(in_array('plugin-directory/plugin-file.php', apply_filters('active_plugins', get_option('active_plugins')))){ 
    //whatever you need goes here. 
}