Conditions for Wishlist and ActiveMember360
-
Has anyone created the custom conditions for the Wishlist and/or ActiveMember360 membership plugins?
My first need is for the Wishlist membership platform. I would like a conditions loop that will read the membership levels available in Wishlist and then have the checkbox for show/hide if the current user is part of the membership level.
Wishlist has an api (http://codex.wishlistproducts.com/) and it seems like it wouldn’t be too difficult to do. I started but just can’t get a handle on it (I’m not a programmer.)
I’m trying to create custom conditions to show WishList member levels in If Menu and then allow the If Menu logic to work on the member level (same way that it does with WP user roles.
I’m close (see code below). I can get all the WL Levels to show up for Menu Admin, and can select the condition. But for some reason I can’t get the user Front end to work with it… I can’t seem to get the conditional logic to evaluate to true and show a menu item. Looking at the array I have something like,
name, condition, group
… and when I echo the array I can see that the condition value = 1. But it just doesn’t validate as true and enable the menu item on the front end. Any ideas?
Would someone be willing to give this a go? Also, it would be cool if there was a webpage repository of If Menu snippets that people could donate to with their custom conditionals… 🙂
// If Menu theme's functions.php or plugin file // For adding WishList member levels to If Menu conditions add_filter( 'if_menu_conditions', 'wlm_menu_condition' ); function wlm_menu_condition( $conditions ) { //Navigate down to the levels array $levels = wlmapi_the_levels(); $levels_array = $levels['levels']['level']; $member_id = get_current_user_id(); Foreach ( $levels_array as $level) { $level_id = $level[id]; $level_name = $level[name]; $check = wlmapi_is_user_a_member( $level_id, $member_id); //echo( 'level_id = ' . $level_id) . ' | '; //echo( 'level_name = ' . $level_name) . ' | '; //echo( 'check = ' . $check); //echo( '<br>'); //die('VALUE IS: ' . $level_name) ; $conditions[] = array( 'name' => $level_name, // name of the wl member level 'condition' => $check, 'group' => 'WL Level' ); } return $conditions; }
- The topic ‘Conditions for Wishlist and ActiveMember360’ is closed to new replies.