Plugin Directory

Changeset 3198696


Ignore:
Timestamp:
11/28/2024 09:05:26 AM (15 months ago)
Author:
kantbtrue
Message:

Sale

Location:
kantbtrue-about-me
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • kantbtrue-about-me/tags/1.2.11/kantbtrue-about-me.php

    r2661961 r3198696  
    118118}
    119119add_action( 'wp_ajax_kbtam_feedback', 'kbtam_send_feedback' );
     120
     121/**
     122 * Show Black Friday discount notice.
     123 *
     124 * @since 1.2.11
     125 * @return void
     126 */
     127function kbtam_show_black_friday_notice() {
     128    // Check if the notice has already been dismissed.
     129    if ( get_option( 'kbtam_black_friday_dismissed' ) ) {
     130        return;
     131    }
     132    ?>
     133    <div class="notice notice-success is-dismissible kbtam-black-friday-notice">
     134        <p><?php _e( 'Black Friday Deal! Get 50% off with coupon code <strong>FRIDAY50</strong>. Don\'t miss out!', 'kantbtrue-about-me' ); ?></p>
     135        <p><button id="kbtam-black-friday-btn" class="button button-primary"><?php _e( 'Get Deal', 'kantbtrue-about-me' ); ?></button></p>
     136    </div>
     137    <script type="text/javascript">
     138        jQuery(document).ready(function($) {
     139            $('#kbtam-black-friday-btn').on('click', function() {
     140                window.location.href = 'https://kantbtrue.gumroad.com/l/aboutmepro';
     141            });
     142        });
     143    </script>
     144    <?php
     145}
     146add_action( 'admin_notices', 'kbtam_show_black_friday_notice' );
     147
     148/**
     149 * Handle dismissing the Black Friday notice.
     150 *
     151 * @since 1.2.11
     152 * @return void
     153 */
     154function kbtam_dismiss_black_friday_notice() {
     155    // Check for nonce security.
     156    if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['nonce'] ), 'KBTAM_nonce' ) ) {
     157        wp_die( esc_html__( 'Not permitted.', 'kantbtrue-about-me' ) );
     158    }
     159
     160    // Update the option to mark the notice as dismissed.
     161    update_option( 'kbtam_black_friday_dismissed', true );
     162
     163    // Send response.
     164    $res = array(
     165        'status' => 'success',
     166    );
     167    wp_send_json($res);
     168}
     169add_action( 'wp_ajax_kbtam_dismiss_black_friday', 'kbtam_dismiss_black_friday_notice' );
  • kantbtrue-about-me/tags/1.2.11/readme.txt

    r3104279 r3198696  
    33Tags: about me, about me widget, about widget, about author, author box, profile widget
    44Requires at least: 5.0
    5 Tested up to: 6.5.4
     5Tested up to: 5.8.2
    66Requires PHP: 5.0
    77Stable tag: 1.2.11
  • kantbtrue-about-me/trunk/kantbtrue-about-me.php

    r2661961 r3198696  
    118118}
    119119add_action( 'wp_ajax_kbtam_feedback', 'kbtam_send_feedback' );
     120
     121/**
     122 * Show Black Friday discount notice.
     123 *
     124 * @since 1.2.11
     125 * @return void
     126 */
     127function kbtam_show_black_friday_notice() {
     128    // Check if the notice has already been dismissed.
     129    if ( get_option( 'kbtam_black_friday_dismissed' ) ) {
     130        return;
     131    }
     132    ?>
     133    <div class="notice notice-success is-dismissible kbtam-black-friday-notice">
     134        <p><?php _e( 'Black Friday Deal! Get 50% off with coupon code <strong>FRIDAY50</strong>. Don\'t miss out!', 'kantbtrue-about-me' ); ?></p>
     135        <p><button id="kbtam-black-friday-btn" class="button button-primary"><?php _e( 'Get Deal', 'kantbtrue-about-me' ); ?></button></p>
     136    </div>
     137    <script type="text/javascript">
     138        jQuery(document).ready(function($) {
     139            $('#kbtam-black-friday-btn').on('click', function() {
     140                window.location.href = 'https://kantbtrue.gumroad.com/l/aboutmepro';
     141            });
     142        });
     143    </script>
     144    <?php
     145}
     146add_action( 'admin_notices', 'kbtam_show_black_friday_notice' );
     147
     148/**
     149 * Handle dismissing the Black Friday notice.
     150 *
     151 * @since 1.2.11
     152 * @return void
     153 */
     154function kbtam_dismiss_black_friday_notice() {
     155    // Check for nonce security.
     156    if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['nonce'] ), 'KBTAM_nonce' ) ) {
     157        wp_die( esc_html__( 'Not permitted.', 'kantbtrue-about-me' ) );
     158    }
     159
     160    // Update the option to mark the notice as dismissed.
     161    update_option( 'kbtam_black_friday_dismissed', true );
     162
     163    // Send response.
     164    $res = array(
     165        'status' => 'success',
     166    );
     167    wp_send_json($res);
     168}
     169add_action( 'wp_ajax_kbtam_dismiss_black_friday', 'kbtam_dismiss_black_friday_notice' );
  • kantbtrue-about-me/trunk/readme.txt

    r3104279 r3198696  
    33Tags: about me, about me widget, about widget, about author, author box, profile widget
    44Requires at least: 5.0
    5 Tested up to: 6.5.4
     5Tested up to: 5.8.2
    66Requires PHP: 5.0
    77Stable tag: 1.2.11
Note: See TracChangeset for help on using the changeset viewer.