Skip to content

Instantly share code, notes, and snippets.

@arelthia
Last active December 16, 2015 00:59
Show Gist options
  • Save arelthia/5351450 to your computer and use it in GitHub Desktop.
Save arelthia/5351450 to your computer and use it in GitHub Desktop.
Determines if the specified WLM membership level exists for the current user
/*
* determines if the specified membership level exists for the current user
* returns 0 (level does not match user) or 1 (level matched user)
*accepts string level name
*/
function pp_get_level($culevel){
//get the current user
$current_user = wp_get_current_user();
//get the users id
$member_id = $current_user->ID;
//get all the levels for the user
$results = WLMAPI::GetUserLevels($member_id);
//check to see if $culevel is in the results array and returns yes or no
return in_array($culevel, $results);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment