I’m so sorry…
of course – first I only did change this but Error again. After I tried other.
Then I did try again to exclude a standard role ‘subscriber’ instead of my own but the same …
//* Catalog Enquiry user role
function user_role_exclude_catalog(){
global $WC_Woocommerce_Catalog_Enquiry;
$current_user = wp_get_current_user();
if($WC_Woocommerce_Catalog_Enquiry){
if(in_array('subscriber', $current_user->roles)){
remove_action('woocommerce_single_product_summary', array($WC_Woocommerce_Catalog_Enquiry->frontend,'add_form_for_enquiry_without_popup'),100);
remove_action('woocommerce_single_product_summary', array($WC_Woocommerce_Catalog_Enquiry->frontend,'add_form_for_enquiry'),100);
}else{
$WC_Woocommerce_Catalog_Enquiry->frontend->init_catalog();
}
}
}
add_action('wp', 'user_role_exclude_catalog', 999);
Fatal error: Uncaught Error: Call to a member function init_catalog() on null in /html/wordpress/wp-content/themes/infinity-pro/functions.php:306 Stack trace: #0 /html/wordpress/wp-includes/class-wp-hook.php(298): user_role_exclude_catalog(Object(WP)) #1 /html/wordpress/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters(NULL, Array) #2 /html/wordpress/wp-includes/plugin.php(515): WP_Hook->do_action(Array) #3 /html/wordpress/wp-includes/class-wp.php(746): do_action_ref_array('wp', Array) #4 /html/wordpress/wp-includes/functions.php(955): WP->main(Array) #5 /html/wordpress/wp-admin/includes/post.php(1072): wp(Array) #6 /html/wordpress/wp-admin/includes/class-wp-posts-list-table.php(142): wp_edit_posts_query() #7 /html/wordpress/wp-admin/edit.php(180): WP_Posts_List_Table->prepare_items() #8 {main} thrown in /html/wordpress/wp-content/themes/infinity-pro/functions.php on line 306