Last active
December 16, 2015 00:59
-
-
Save arelthia/5351450 to your computer and use it in GitHub Desktop.
Determines if the specified WLM membership level exists for the current user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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