• Resolved dlt101

    (@dlt101)


    Please help !!!
    I tried posting this earlier, but it may not have been clear.
    I really would like to make this work, but I’m missing something here.
    The goal is to add a menu option if the user is a “Sponsor” as defined by another plugin.
    Here’s the code. Why does it give me the following 2 errors ????

    Undefined index: user-is-sponsor in wp-content/plugins/if-menu/if-menu.php on line 105
    Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in wp-content/plugins/if-menu/if-menu.php on line 105

    
    // add "affiliate-area" menu item for affiliates
    add_filter( 'if_menu_conditions', 'conditional_affiliate_menu' );
    function conditional_affiliate_menu( $conditions ) {
    	$conditions[] = array(
    		'id'      =>  'user-is-sponsor',
    		'name'    =>  'User is Sponsor',
    		'condition' =>  'this_user_is_affiliate' }
    	);
    	return $conditions;
    }
    function this_user_is_affiliate ($item=array()) {
    	$userID = get_current_user_id();
    	if (!$userID) return 0;
    	return affwp_is_affiliate($userID);  // function in other plugin
    }
Viewing 1 replies (of 1 total)
  • Thread Starter dlt101

    (@dlt101)

    Big OOPS.

    Looks like the above code was not loading at all.
    Fixed load and everything seems to be working now.

Viewing 1 replies (of 1 total)
  • The topic ‘Cannot make this work at all’ is closed to new replies.