Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class WCFM_Store_review_modifier {
- private $review_rating = null;
- public function __construct($comment_id) {
- $this->set_review_rating($comment_id);
- add_filter('wcfmmp_is_allow_product_review_sync_with_store_review', array(&$this, 'can_sync_with_store_review'));
- }
- public function set_review_rating($comment_id) {
- if ( get_option( 'woocommerce_enable_review_rating' ) == 'yes' ) {
- $this->review_rating = intval( get_comment_meta( $comment_id, 'rating', true ) );
- }
- }
- public function can_sync_with_store_review($is_allowed) {
- return $is_allowed && $this->review_rating;
- }
- }
- add_action('comment_post', function($comment_id) {
- new WCFM_Store_review_modifier($comment_id);
- }, 49);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement