PluginProbe
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO / 1.4.14
Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO v1.4.14
1.4.14 1.4.13 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.54 1.3.53 1.3.52 1.3.51 1.3.50 1.3.49 1.3.48 1.3.47 1.3.46 1.3.45 All 177 releases
disco / notice / ReviewNotice.php

ReviewNotice.php in Discount Rules for WooCommerce – Disco | Dynamic Pricing, Conditions, Bulk, Bundle, BOGO 1.4.14, at notice/ReviewNotice.php

70 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Disco Review Notice
4 * add review notice in admin dashboard
5 * @package Disco
6 * @author Ohidul Islam <wahid003@gmail.com>
7 * @sicne 1.2.21
8 */
9
10 namespace Disco\Notice;
11
12 class ReviewNotice {
13 public function __construct() {
14 add_action( 'admin_notices', [ $this, 'display_review_notice' ] );
15 }
16
17 /**
18 * Display the review notice if it hasn't been dismissed.
19 * @throws \Exception
20 *
21 * @return void
22 */
23 public function display_review_notice() {
24 if ( ! is_user_logged_in() ) {
25 return; // Do not show notice to non-logged-in users
26 }
27
28 $admin_page = get_current_screen();
29
30 if (( 'toplevel_page_disco-create-discount' !== $admin_page->id ) ) {
31 return;
32 }
33
34 $user_id = get_current_user_id();
35 $dismiss_value = get_user_meta( $user_id, 'disco_review_dismissed', true );
36
37 // If 'never', don't show the notice
38 if ( $dismiss_value === 'never' ) {
39 return;
40 }
41
42 // If it's a timestamp, check if the snooze period has not yet expired
43 if ( is_numeric( $dismiss_value ) && $dismiss_value > time() ) {
44 return;
45 }
46
47 ?>
48 <div class="disco-review-notice-wrapper">
49 <div class="notice notice-success is-dismissible disco-review-notice">
50 <img class="disco-notice-icon" src="<?php echo esc_url( plugins_url( 'disco/assets/img/disco-notice-icon.svg' ) ); ?>" alt="Disco Logo">
51 <div>
52 <h3 class="disco-review-title">❤️ Loving Disco advanced features and functionality?</h3>
53 <p class="disco-review-subtitle">We’d really appreciate your <span class="disco-review-star">⭑⭑⭑⭑⭑</span> review! Your quick feedback helps us add even more great features. Tell us what you think and keep the fun going! 🥳</p>
54 <div class="disco-review-buttons">
55 <div class="disco-review-buttons-left">
56 <a href="#" class="later-btn disco-dismiss-review disco-notice-secondary-button" data-dismiss="later">Remind me later</a>
57 <a href="#" class="later-btn disco-dismiss-review disco-notice-secondary-button" data-dismiss="never">I already did!</a>
58 <a href="https://wordpress.org/support/plugin/disco/reviews/#new-post" target="_blank" class="review-btn">Review Here</a>
59 </div>
60 <div class="disco-review-buttons-right">
61 <a href="#" id="disco-review-never" class="disco-dismiss-review" data-dismiss="never">I would not</a>
62 </div>
63 </div>
64 </div>
65 </div>
66 </div>
67 <?php
68 }
69 }
70