[Membership 2 Pro] Filtering Conditional Tags

I'm wondering if there is a way to overwrite or filter the conditional tags such as..

ms_show_users_membership()
is_ms_ac_show_activity()
is_ms_ac_show_invoices()

It doesn't look like it but I wanted to double check. The function calls look something like this:

if ( ! function_exists( 'is_ms_ac_show_activity' ) ) {
	function is_ms_ac_show_activity() {
		return mslib3()->is_true( MS_Helper_Template::$ms_account['show_activity'] );
	}
}
  • James Morris

    Hello IQComputing

    For more advanced code level questions such as this, it's best to get our Dev Team feedback. I'm flagging this ticket for them to take a look at. Please note that advanced questions may take a little more time to answer as our Dev Team is quite busy with improving our products. But they will look into this as soon as possible for you.

    Best regards,

    James Morris

  • Ari

    Hi IQComputing

    Yeah, this is possible!

    The above three functions are in same structure, so I'll explain just one, I hope you can manage the others!

    if ( ! function_exists( 'is_ms_ac_show_activity' ) ) {
    	function is_ms_ac_show_activity() {
    		return mslib3()->is_true( MS_Helper_Template::$ms_account['show_activity'] );
    	}
    }

    This code actually return true or false based on the $ms_account['show_activity'] data, we do not have filters for these all functions though, but we have for $ms_account, you can change the data using below filter hook like:

    add_filters( 'ms_shortcode_account_atts_pre', function( $data ) {
    
    	$data['show_activity'] = false;
    
    	return $data;
    
    });

    so now, if is_ms_ac_show_activity function would return true, now it will return false. and this is same for others too.

    If you have still trouble let me know here!

    Regards,
    Ari

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.