Skip to content

Commit

Permalink
4.4.15
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelbart committed Oct 22, 2020
1 parent 62fc613 commit 238114a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
30 changes: 30 additions & 0 deletions core/class-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,4 +396,34 @@ public static function is_amp()

return false;
}

/**
* Sets a capability.
*
* @param string $option
* @param string $value
*
* @return void
*/
public static function set_capability( $option, $value )
{
$options = [
'helpful_capability',
'helpful_settings_capability',
'helpful_feedback_capability',
];

if ( ! in_array( $option, $options ) ) {
return;
}

if ( null === $value || false === $value ) {
delete_option( $option );
}

update_option(
sanitize_text_field( $option ),
sanitize_text_field( $value )
);
}
}
4 changes: 2 additions & 2 deletions core/modules/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function register_admin_menu()
add_menu_page(
__( 'Helpful', 'helpful' ),
__( 'Helpful', 'helpful' ),
'manage_options',
get_option( 'helpful_capability', 'manage_options' ),
'helpful',
[ &$this, 'callback_admin_page' ],
'dashicons-thumbs-up',
Expand All @@ -72,7 +72,7 @@ public function register_admin_menu()
'helpful',
__( 'Settings', 'helpful' ),
__( 'Settings', 'helpful' ),
'manage_options',
get_option( 'helpful_settings_capability', 'manage_options' ),
'helpful',
[ &$this, 'callback_admin_page' ]
);
Expand Down
2 changes: 1 addition & 1 deletion core/modules/class-feedback-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function add_submenu()
'helpful',
__( 'Helpful Feedback', 'helpful' ),
__( 'Feedback', 'helpful' ),
'publish_posts',
apply_filters( 'helpful_feedback_capability', 'publish_posts' ),
'helpful_feedback',
[ &$this, 'admin_page_callback' ]
);
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.14
* Version: 4.4.15
* 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.14
Stable tag: 4.4.15
License: MIT License
License URI: https://opensource.org/licenses/MIT

Expand Down

0 comments on commit 238114a

Please sign in to comment.