• Resolved danielru92

    (@danielru92)


    Hi! I just can’t figure out how to insert custom vars to conditions.. My last try made http error 500 to my site. That is the code I inserted into functions.php :

    add_filter( "eleconditions_vars",function($custom_vars));
    function($custom_vars) {
    	global $user;
    	if ( isset( $user ) ) {
        	$phonenumber = get_user_meta($user->ID, 'digits_phone', true);
    		if ( isset($phonenumber) ) 
          		$custom_vars['phoneexist']=true;
    		else
    			$custom_vars['phoneexist']=false;
    	}
    	return $custom_vars;
    };
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author dudaster

    (@dudaster)

    Have you tried to run to function code in header/function and see if it works?

    Thread Starter danielru92

    (@danielru92)

    yes it made error 500

    Plugin Author dudaster

    (@dudaster)

    add_filter( "eleconditions_vars",function($custom_vars){
    	global $user;
    	if ( isset( $user ) ) {
        	$phonenumber = get_user_meta($user->ID, 'digits_phone', true);
    		if ( isset($phonenumber) ) 
          		$custom_vars['phoneexist']=true;
    		else
    			$custom_vars['phoneexist']=false;
    	}
    	return $custom_vars;
    });

    try this

    please make sure your code is ok and respects php rules.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Plugin is not working with custom vars’ is closed to new replies.