Override WP Class Private Function

Question

I’m new to community, I think you experts can help me in this.
I have plugin installed and i want to its overwrite one function which is in class

    <?php 

 class wf_fedex_woocommerce_shipping_admin{

private function wf_user_permission($auto_generate=null){

$current_minute=(integer)date('i');
        if(!empty($auto_generate) && ($auto_generate==md5($current_minute) || $auto_generate==md5($current_minute+1) ))
        {
            return true;
        }
        $current_user = wp_get_current_user();
        $user_ok = false;
        $wf_roles = apply_filters( 'wf_user_permission_roles', array('administrator', 'shop_manager') );

        if ($current_user instanceof WP_User) {
            $role_ok = array_intersect($wf_roles, $current_user->roles);
            if( !empty( $role_ok ) ){
                $user_ok = true;
            }
        }
        return $user_ok;
}
}
?>

I want to rewrite if so WP will use my custom instead of plugin
I need a single change in new function ( I mean i just need pass ‘subscriber’ in array )

$wf_roles = apply_filters( 'wf_user_permission_roles', array('administrator', 'shop_manager', 'subscriber') );

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/override-wp-class-private-function/">

Override WP Class Private Function</a>
0
, Naveen Guleria 2 months 0 Answers 37 views 0

Leave an answer