If you’re running the latest version of WishList Member, it now has built-in API functions for stuff like this. Using those, you’d do this:
wp_get_current_user();
$gold_sku = 123456789;
$silver_sku = 987654321;
$user_id = $user->ID;
if ( wlmapi_is_user_a_member($gold_sku, $user_id) ) {
//Do gold stuff here
} elseif ( wlmapi_is_user_a_member($silver_sku, $user_id) ) {
//Do silver stuff here
}
If want to check that they belong to BOTH levels, do this:
if ( wlmapi_is_user_a_member($gold_sku, $user_id) && wlmapi_is_user_a_member($silver_sku, $user_id) ) {
//Do gold AND silver stuff here
}
If you want to check that they belong to EITHER level, do this:
if ( wlmapi_is_user_a_member($gold_sku, $user_id) || wlmapi_is_user_a_member($silver_sku, $user_id) ) {
//Do gold AND silver stuff here
}
You can check the Codex for this function here:
http://codex.wishlistproducts.com/function-reference-wlmapi_is_user_a_member/