/** * Process WooCommerce Memberships data to see if a member has any active * memberships or not. Cache the result in the Akses specific data base. * * @param int $userId User ID. */ private static function process_wc_membership_member_status($userId) { $is_active = false; if (function_exists('wc_memberships')) { // check if the member has an active membership for any plan foreach (wc_memberships_get_membership_plans() as $plan) { if (wc_memberships_is_user_active_member($userId, $plan)) { $is_active = true; break; } } } else { error_log('Can not process membership statuses: WooCommerce Memberships is not installed.'); } Akses_Membership::set_member_active($userId, $is_active); }