Skip to content

Commit

Permalink
4.4.28
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelbart committed Mar 17, 2021
1 parent aa5f615 commit c39386d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
20 changes: 10 additions & 10 deletions core/helpers/class-feedback.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,16 @@ public static function after_vote( $post_id, $show_feedback = false )
$user_id = User::get_user();
$type = User::get_user_vote_status( $user_id, $post_id );

if ( true === $show_feedback ) {
$feedback_text = get_option( 'helpful_feedback_message_voted' );
$feedback_text = apply_filters( 'helpful_pre_feedback_message_voted', $feedback_text, $post_id );
}

if ( 'pro' === $type ) {
$feedback_text = get_option( 'helpful_feedback_message_pro' );

if ( true !== $show_feedback ) {
if ( ! get_option( 'helpful_feedback_after_pro' ) || false !== $hide_feedback ) {
if ( false === $show_feedback ) {
if ( ! get_option( 'helpful_feedback_after_pro' ) || true === $hide_feedback ) {
$content = do_shortcode( get_option( 'helpful_after_pro' ) );

if ( get_post_meta( $post_id, 'helpful_after_pro', true ) ) {
Expand All @@ -458,8 +463,8 @@ public static function after_vote( $post_id, $show_feedback = false )
if ( 'contra' === $type ) {
$feedback_text = get_option( 'helpful_feedback_message_contra' );

if ( true !== $show_feedback ) {
if ( ! get_option( 'helpful_feedback_after_contra' ) || false !== $hide_feedback ) {
if ( false === $show_feedback ) {
if ( ! get_option( 'helpful_feedback_after_contra' ) || true === $hide_feedback ) {
$content = do_shortcode( get_option( 'helpful_after_contra' ) );

if ( get_post_meta( $post_id, 'helpful_after_contra', true ) ) {
Expand All @@ -472,7 +477,7 @@ 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 ) {
if ( ! get_option( 'helpful_feedback_after_pro' ) && ! get_option( 'helpful_feedback_after_contra' ) && false === $show_feedback ) {
$content = do_shortcode( get_option( 'helpful_after_fallback' ) );

if ( get_post_meta( $post_id, 'helpful_after_fallback', true ) ) {
Expand All @@ -483,11 +488,6 @@ public static function after_vote( $post_id, $show_feedback = false )
}
}

if ( false !== $show_feedback ) {
$feedback_text = get_option( 'helpful_feedback_message_voted' );
$feedback_text = apply_filters( 'helpful_pre_feedback_message_voted', $feedback_text, $post_id );
}

if ( isset( $feedback_text ) && '' === trim( $feedback_text ) ) {
$feedback_text = false;
}
Expand Down
8 changes: 7 additions & 1 deletion core/modules/class-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function save_vote()
$value = sanitize_text_field( $_POST['value'] );
}

if ( ! Helpers\User::check_user( $user_id, $post_id ) ) {
if ( false === Helpers\User::check_user( $user_id, $post_id ) ) {
if ( 'pro' === $value ) {
Helpers\Values::insert_pro( $user_id, $post_id );
} else {
Expand Down Expand Up @@ -264,11 +264,17 @@ public function save_feedback()
Helpers\Feedback::insert_feedback();
}

/* OLD STYLE */
/*
$type = 'pro';
if ( isset( $_REQUEST['type'] ) ) {
$type = sanitize_text_field( $_REQUEST['type'] );
}
*/

$user_id = Helpers\User::get_user();
$type = Helpers\User::get_user_vote_status( $user_id, $post_id );

if ( 'pro' === $type ) {
$message = do_shortcode( get_option( 'helpful_after_pro' ) );
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.27
* Version: 4.4.28
* 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.7
Requires PHP: 5.6.20
Stable tag: 4.4.27
Stable tag: 4.4.28
License: MIT License
License URI: https://opensource.org/licenses/MIT

Expand Down

0 comments on commit c39386d

Please sign in to comment.