Support » Plugin: If Menu - Visibility control for Menu Items » Conditions for Wishlist and ActiveMember360

  • Resolved Norm Sash

    (@normsash)


    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;
    }
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Andrei Igna

    (@andreiigna)

    Hi Norm,

    First of all, thanks for using the plugin!

    There’s some good news, If Menu will add integrations with other plugins and Wishlist is one of them. The update will be ready in ~10 days.

    That’s really awesome news Andrei! I just slammed on the brakes on the work I’m doing and will just wait for this great release. Not to be greedy, but in addition to Wishlist, is ActiveMember 360 also on the list? 😉

    Plugin Author Andrei Igna

    (@andreiigna)

    I will check the plugin and will probably add it.

    Just to be aware, the new version will have a paid plan (~10-15$ a year) to support the development for new features and constant integration with other plugins.

    Sneak peek of a new feature
    Screen_Shot_2017_12_04_at_12_14_34

    Hi Andre,

    I see that the new version of If Menu is out with the support for Wishlist. Thanks for adding my request into the plugin. Is there anyway to get an eval copy of it just to make sure it is working?

    Thanks,
    Norm

    Plugin Author Andrei Igna

    (@andreiigna)

    Hi Norm,

    Thanks for the suggestion, a few other site owners requested this so was added 🙂

    Can you let me know on which site are you using the plugin? Can be sent to wp@layered.studio

    Cheers

    Done… email sent. Thanks Andrei.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Conditions for Wishlist and ActiveMember360’ is closed to new replies.