Advertisement
palsushobhan

wcfm-content-check.php

Oct 31st, 2022
1,008
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.40 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Plugin Name: WCFM – Content Restriction 2
  4.  * Plugin URI: http://wclovers.com
  5.  * Description: WCFM Messages Content Restriction Customization
  6.  * Author: WC Lovers
  7.  * Version: 2.1.0
  8.  * Author URI: http://wclovers.com
  9.  *
  10.  * Text Domain: wcfm-content-check
  11.  * Domain Path: /lang/
  12.  *
  13.  * WC requires at least: 3.0.0
  14.  * WC tested up to: 3.6.0
  15.  *
  16.  */
  17.  
  18. if (!defined('ABSPATH')) exit; // Exit if accessed directly
  19.  
  20. if (!class_exists('WCFM')) return; // Exit if WCFM not installed
  21.  
  22. add_filter('wcfm_is_allow_enquiry_by_customer', '__return_false');
  23. add_filter('wcfm_is_allow_enquiry_customer_reply', '__return_false');
  24.  
  25. add_filter('wcfm_enquiry_content', function ($content, $product_id, $vendor_id, $customer_id) {
  26.     if (function_exists('wcfm_filter_content_email_phone')) {
  27.         $new_content = wcfm_filter_content_email_phone($content);
  28.         if($new_content!=$content) {
  29.             return 'predefined text which would include terms and conditions for use of inquiry module';
  30.         }
  31.     }
  32.     return $content;
  33. }, 50, 4);
  34.  
  35. add_filter('wcfm_enquiry_reply_content', function ($content, $product_id, $vendor_id, $customer_id) {
  36.     if (function_exists('wcfm_filter_content_email_phone')) {
  37.         $new_content = wcfm_filter_content_email_phone($content);
  38.         if($new_content!=$content) {
  39.             return 'predefined text which would include terms and conditions for use of inquiry module';
  40.         }
  41.     }
  42.     return $content;
  43. }, 50, 4);
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement