Skip to content

Commit

Permalink
4.4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelbart committed Sep 22, 2020
1 parent 8143264 commit 6998688
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
6 changes: 6 additions & 0 deletions core/helpers/class-feedback.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,12 @@ public static function after_vote( $post_id, $show_feedback = false )
}
}

if ( 'none' === $type ) {
if ( ! get_option( 'helpful_feedback_after_pro' ) && ! get_option( 'helpful_feedback_after_contra' ) && true !== $show_feedback ) {
return do_shortcode( get_option( 'helpful_after_fallback' ) );
}
}

if ( false !== $show_feedback ) {
$feedback_text = get_option( 'helpful_feedback_message_voted' );
}
Expand Down
4 changes: 4 additions & 0 deletions core/helpers/class-user.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ public static function check_user( $user_id, $post_id )
return false;
}

if ( 'on' === get_option( 'helpful_user_random' ) ) {
return false;
}

global $wpdb;
$table_name = $wpdb->prefix . 'helpful';
$sql = "
Expand Down
19 changes: 14 additions & 5 deletions core/modules/class-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public function save_vote()
}
}

echo $response;
echo apply_filters( 'helpful_the_content', $response, $post_id );
wp_die();
}

Expand All @@ -226,6 +226,12 @@ public function save_feedback()

do_action( 'helpful_ajax_save_feedback' );

$post_id = null;

if ( isset( $_REQUEST['post_id'] ) && is_numeric( $_REQUEST['post_id'] ) ) {
$post_id = intval( $_REQUEST['post_id'] );
}

/**
* Simple Spam Protection
*/
Expand All @@ -238,7 +244,8 @@ public function save_feedback()
}

if ( ! empty( $_REQUEST['website'] ) && true === $spam_protection ) {
echo do_shortcode( get_option( 'helpful_feedback_message_spam' ) );
$message = do_shortcode( get_option( 'helpful_feedback_message_spam' ) );
echo apply_filters( 'helpful_the_content', $message, $post_id );
wp_die();
}

Expand All @@ -253,13 +260,15 @@ public function save_feedback()
}

if ( 'pro' === $type ) {
echo do_shortcode( get_option( 'helpful_after_pro' ) );
$message = do_shortcode( get_option( 'helpful_after_pro' ) );
} elseif ( 'contra' === $type ) {
echo do_shortcode( get_option( 'helpful_after_contra' ) );
$message = do_shortcode( get_option( 'helpful_after_contra' ) );
} else {
echo do_shortcode( get_option( 'helpful_after_fallback' ) );
$message = do_shortcode( get_option( 'helpful_after_fallback' ) );
}

echo apply_filters( 'helpful_the_content', $message, $post_id );

wp_die();
}

Expand Down
2 changes: 1 addition & 1 deletion helpful.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: Helpful
* Description: Add a fancy feedback form under your posts or post-types and ask your visitors a question. Give them the abbility to vote with yes or no.
* Version: 4.4.6
* Version: 4.4.7
* Author: Pixelbart
* Author URI: https://pixelbart.de
* Text Domain: helpful
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: helpful, poll, feedback, reviews, vote, review, voting
Requires at least: 4.6
Tested up to: 5.6
Requires PHP: 5.6.20
Stable tag: 4.4.6
Stable tag: 4.4.7
License: MIT License
License URI: https://opensource.org/licenses/MIT

Expand Down

0 comments on commit 6998688

Please sign in to comment.