• squcsg



    This argent

    I’m trying to add filter to the plugin to make it compatible with pmp plugin.
    it shows me this error:
    Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in \wp-content\plugins\if-menu\if-menu.php on line 110

    This is line 110 in if-menu.php:
    $singleCondition .= call_user_func_array($conditions[$if_conditions[$index]][‘condition’], $params) ? $bit1 : $bit2;

    this is my code:

    // get the user ID:
    $current_user_id = get_current_user_id();
    // get the level ID:
    $membership_level = pmpro_getMembershipLevelForUser($current_user_id);
    //add filter:
    add_filter( ‘if_menu_conditions’, ‘f_if_menu’ );
    //create the filter function:

    function f_if_menu( $conditions ) {

    $conditions[] = array(
    ‘name’ => ‘RG_PH2’, // name of the condition
    ‘condition’ => function($item) { // callback – must return TRUE or FALSE

    //compare between the levels:
    if ($membership_level == 1)
    return true;
    return false;

    return $conditions;

    side note: I’m using localhost as a development environment

  • You must be logged in to reply to this topic.