Skip to content

Commit f091229

Browse files
committed
fixed bug in the settings
1 parent 2b63f52 commit f091229

10 files changed

Lines changed: 1902 additions & 127 deletions

File tree

README.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,9 @@ For multiselect just keep pressing ctrl while you are selecting more than one ta
6161

6262
== Changelog ==
6363

64+
= 1.0.1 =
65+
* Improvement on WooCommerce detection also on multiste
66+
* Removed sidebar in settings that creates problems on saving
67+
6468
= 1.0 =
6569
* First release

admin/includes/WC_Integration_TReport.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class WC_Integration_TReport extends WC_Integration {
1111
* Init and hook in the integration.
1212
*/
1313
public function __construct() {
14-
global $woocommerce;
1514
$this->id = 'taxonomy-report';
1615
$this->method_title = __( 'Taxonomy Report', 'woo-taxonomy-report' );
1716
$this->method_description = __( 'Add reports based on taxonomies.', 'woo-taxonomy-report' );
@@ -75,7 +74,6 @@ public function load_taxonomies_by_wc() {
7574
*/
7675
public function admin_options() {
7776
parent::admin_options();
78-
include('sidebar.php');
7977
}
8078

8179
/**

admin/includes/WP-Dismissible-Notices-Handler/LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# WordPress Dismissible Notices Handler
2+
3+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/julien731/WP-Dismissible-Notices-Handler/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/julien731/WP-Dismissible-Notices-Handler/?branch=master)
4+
5+
Since version 4.2, WordPress has a built-in mechanism for handling dismissible admin notices. While this mechanism handles dismissing notices, the dismissal isn't persistent. This means that a user would see the notice on every page load, even though he or she dismissed the notice already.
6+
7+
What the Dismissible Notices Handler (DNH) library does is handle the persistent part of dismissing admin notices.
8+
9+
## How It Works
10+
11+
The DNH library is extremely simple to use and yet has a couple of advanced options.
12+
13+
The basics of it is to register a new admin notice. You really need 3 things for registering a notice:
14+
15+
- a unique ID that will identify the notice (you will be warned in case of ID conflicts)
16+
- a notice type
17+
- a message to display in the notice
18+
19+
There is a handy helper function available for notice registration: `dnh_register_notice()`
20+
21+
This function takes 3 parameters:
22+
23+
- `$id` *(string)*: the unique ID of the notice
24+
- `$type` *(string)*: the type of notice you want to display. Currently it can be `error` for an error notice or `updated` for a success/update notice
25+
- `$content` *(string)*: the content of the admin notice
26+
- `$args` *(array)*: additional parameters that can be passed to the notice handler (see below)
27+
28+
#### Installation
29+
30+
The simpest way to use DNH is to add it as a Composer dependency:
31+
32+
```
33+
composer require julien731/wp-dismissible-notices-handler
34+
```
35+
36+
### Example
37+
38+
Registering an admin notice would look like that:
39+
40+
```
41+
dnh_register_notice( 'my_notice', 'updated', __( 'This is my notice' ) );
42+
```
43+
44+
## Advanced Parameters
45+
46+
The function takes an array of optional parameters allowing more control over the notices and how they're dismissed. Only 2 parameters are available so far but hopefully more will be coming soon.
47+
48+
Hereafter is the list of available parameters to be passed in the `$args` array. Please note that the `$args` parameter is optional.
49+
50+
| Parameter | Possible Value(s) | Default | Description |
51+
|-----------|--------------------------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
52+
| scope | user, global | user | Whether the notice should be dismissed for the current user only or globally on the site. A notice dismissed for a user will still show up for other users, while a notice dismissed globally will not be displayed anymore after being dismissed once. |
53+
| cap | Any WordPress capability | | If not empty, the handler will check if the current user has the specified before displaying the notice. |
54+
| class | string | | Additional class to add to the notice wrapper | | | |
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
jQuery(document).ready(function($) {
2+
$( '.notice.is-dismissible' ).on('click', '.notice-dismiss', function ( event ) {
3+
event.preventDefault();
4+
var $this = $(this);
5+
if( 'undefined' == $this.parent().attr('id') ){
6+
return;
7+
}
8+
$.post( ajaxurl, {
9+
action: 'dnh_dismiss_notice',
10+
url: ajaxurl,
11+
id: $this.parent().attr('id')
12+
});
13+
14+
});
15+
});

0 commit comments

Comments
 (0)