PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 1.2.2
Forumax – AI Powered Advanced Community Forum Plugin v1.2.2
2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 2.0.0 All 30 releases
bbp-core / includes / admin / notices / asking-for-review.php

asking-for-review.php in Forumax – AI Powered Advanced Community Forum Plugin 1.2.2, at includes/admin/notices/asking-for-review.php

52 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 $optionReview = get_option('bbpc_notify_review');
3 if ( is_admin() && time() >= (int)$optionReview && $optionReview !== '0') {
4 add_action('admin_notices', 'bbpc_notify_give_review');
5 wp_enqueue_script( 'bbpc-notify-review' );
6 }
7 add_action('wp_ajax_bbpc_notify_save_review', 'bbpc_notify_save_review');
8
9 /**
10 ** Give Notice
11 **/
12 function bbpc_notify_give_review() {
13 ?>
14 <div class="notice notice-success is-dismissible" id="bbpc_notify_review">
15 <h3> <?php _e('Give BBP Core a review', 'bbp-core'); ?> </h3>
16 <p>
17 <?php _e('Thank you for choosing BBP Core. We hope you love it. Could you take a couple of seconds posting a nice review to share your happy experience?', 'bbp-core')?>
18 </p>
19 <p class="bbpc_notify_review_subheading">
20 <?php _e('We will be forever grateful. Thank you in advance.', 'bbp-core'); ?>
21 </p>
22 <p>
23 <a href="javascript:void(0)" data="rateNow" class="button button-primary" style="margin-right: 5px"><?php _e('Rate now', 'bbp-core')?></a>
24 <a href="javascript:void(0)" data="later" class="button" style="margin-right: 5px"><?php _e('Later', 'bbp-core')?></a>
25 <a href="javascript:void(0)" data="alreadyDid" class="button"><?php _e('Already did', 'bbp-core')?></a>
26 </p>
27 </div>
28 <?php
29 }
30
31 /**
32 ** Save Notice
33 **/
34 function bbpc_notify_save_review() {
35 if ( isset( $_POST ) ) {
36 $nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( $_POST['nonce'] ) : null;
37 $field = isset( $_POST['field'] ) ? sanitize_text_field( $_POST['field'] ) : null;
38
39 if ( ! wp_verify_nonce( $nonce, 'bbpc-admin-nonce' ) ) {
40 wp_send_json_error( array( 'status' => 'Wrong nonce validate!' ) );
41 exit();
42 }
43
44 if ( $field == 'later' ) {
45 update_option('bbpc_notify_review', time() + 3*60*60*24); //After 3 days show
46 } else if ($field == 'alreadyDid') {
47 update_option('bbpc_notify_review', 0);
48 }
49 wp_send_json_success();
50 }
51 wp_send_json_error( array( 'message' => 'Update fail!' ) );
52 }