Skip to content

Commit

Permalink
4.0.23
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelbart committed Sep 24, 2019
1 parent 8d5e856 commit 9ec1475
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
7 changes: 7 additions & 0 deletions core/classes/class-helpful-metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public function render_metabox() {
$pro_percent = Helpful_Helper_Stats::getPro( $post->ID, true );
$contra = Helpful_Helper_Stats::getContra( $post->ID );
$contra_percent = Helpful_Helper_Stats::getContra( $post->ID, true );
$hide = get_post_meta( $post->ID, 'helpful_hide_on_post', true );

wp_nonce_field( 'helpful_remove_data', 'helpful_remove_data_nonce' );
include HELPFUL_PATH . 'templates/admin-metabox.php';
Expand All @@ -91,5 +92,11 @@ public function save_metabox_data( $post_id ) {
if ( 'yes' === $_POST['helpful_remove_data'] ) {
Helpful_Helper_Values::removeData( $post_id );
}

if ( isset( $_POST['helpful_hide_on_post'] ) ) {
update_post_meta( $post_id, 'helpful_hide_on_post', 'on' );
} else {
update_post_meta( $post_id, 'helpful_hide_on_post', 'off' );
}
}
}
4 changes: 4 additions & 0 deletions core/classes/class-helpful-shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ public function add_to_content( $content ) {
$post_types = get_option( 'helpful_post_types' );
$user_id = Helpful_Helper_Values::getUser();

if ( 'on' === get_post_meta( $post->ID, 'helpful_hide_on_post', true ) ) {
return $content;
}

if ( ! is_array( $post_types ) || ! in_array( $post->post_type, $post_types, true ) ) {
return $content;
}
Expand Down
4 changes: 2 additions & 2 deletions 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.0.22
* Version: 4.0.23
* Author: Pixelbart
* Author URI: https://pixelbart.de
* Text Domain: helpful
Expand All @@ -17,7 +17,7 @@

define( 'HELPFUL_FILE', __FILE__ );
define( 'HELPFUL_PATH', plugin_dir_path( HELPFUL_FILE ) );
define( 'HELPFUL_VERSION', '4.0.22' );
define( 'HELPFUL_VERSION', '4.0.23' );
define( 'HELPFUL_PHP_MIN', '5.4.0' );

/* Include config */
Expand Down
6 changes: 5 additions & 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.2
Requires PHP: 5.4.0
Stable tag: 4.0.22
Stable tag: 4.0.23
License: MIT License
License URI: https://opensource.org/licenses/MIT

Expand Down Expand Up @@ -86,6 +86,10 @@ Switch to the Helpful settings and click on the System tab. There you will find

== Changelog ==

= 4.0.23 =
* In the Metabox within posts, Helpful can now be disabled for each post.
* Date: 24.09.2019

= 4.0.22 =
* Fixed another bug in the Dashboard widget related to the date format.
* Date: 05.09.2019
Expand Down
13 changes: 12 additions & 1 deletion templates/admin-metabox.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<table class="form-table meta_box">
<tbody>
<tbody>
<tr>
<th style="width:20%"><label><?php echo esc_html_x('Pro', 'meta box label', 'helpful'); ?></label></th>
<td><?php echo $pro; ?> <?php printf("(%s%%)", $pro_percent); ?></td>
Expand All @@ -19,5 +19,16 @@
</label>
</td>
</tr>
<tr>
<th style="width:20%">
<label for="helpful_hide_on_post"><?php echo esc_html_x('Hide Helpful', 'meta box label', 'helpful'); ?></label>
</th>
<td>
<input type="checkbox" name="helpful_hide_on_post" id="helpful_hide_on_post" value="yes" <?php checked( $hide, 'on' ); ?>>
<label for="helpful_hide_on_post">
<span class="description"><?php echo esc_html_x('Select to hide Helpful in this post.', 'checkbox label', 'helpful'); ?></span>
</label>
</td>
</tr>
</tbody>
</table>

0 comments on commit 9ec1475

Please sign in to comment.