You could use the get_var
method of the $wpdb
class to write a helper function to test for membership. (This code is untested.)
function is_user_a_member($userID){
global $wpdb;
$membershipID = $wpdb->get_var($wpdb->prepare("SELECT membership_id FROM jobo_pmpro_memberships_users WHERE user_id=%d",$userID));
return !empty($membership_id);
}
if( is_user_a_member(get_current_user_id()) ){
//do your code
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…