Changeset 3002205
- Timestamp:
- 11/27/2023 01:29:38 PM (2 years ago)
- Location:
- reviews-sorted/trunk
- Files:
-
- 2 edited
-
README.txt (modified) (2 diffs)
-
reviews-sorted.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
reviews-sorted/trunk/README.txt
r2996967 r3002205 5 5 Tested up to: 6.3.2 6 6 Requires PHP: 7.2 7 Stable tag: 2.3. 37 Stable tag: 2.3.4 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 74 74 == Changelog == 75 75 76 = v2.3.4 (Nov 27, 2023) = 77 * Added admin notice. 78 76 79 = v2.3.3 (Nov 06, 2023) = 77 80 * Remove the decimal point to show review percentage. -
reviews-sorted/trunk/reviews-sorted.php
r2996967 r3002205 6 6 * Author: Reviews Sorted 7 7 * Author URI: https://reviewssorted.com/ 8 * Version: 2.3. 38 * Version: 2.3.4 9 9 * Text Domain: reviews-sorted 10 10 * Domain Path: /languages … … 154 154 } 155 155 } 156 157 /** 158 * Check if the website has collected 10 reviews and display notice in Dashboard 159 **/ 160 function review_sorted_check_ten_reviews_collected() { 161 162 global $pagenow; 163 if ( $pagenow == 'index.php' ) { 164 165 $RS_Review = new ReviewsSortedFeedback(); 166 167 $data = $RS_Review->get_total(); 168 169 $reviews_count = isset( $data['totalReviews'] ) ? $data['totalReviews'] : 0; 170 171 if( $reviews_count >= 10 ) { 172 add_action( 'admin_notices', 'review_sorted_ten_reviews_admin_notice' ); 173 } 174 } 175 } 176 add_action( 'admin_init', 'review_sorted_check_ten_reviews_collected', 999 ); 177 178 /** 179 * Display Admin Notice after the website has collected 10 reviews 180 **/ 181 function review_sorted_ten_reviews_admin_notice() { 182 183 $current_user = wp_get_current_user(); 184 if( !empty( $current_user->user_firstname ) || !empty( $current_user->user_lastname ) ){ 185 $firstname = !empty( $current_user->user_firstname ) ? $current_user->user_firstname : ''; 186 $lastname .= !empty( $current_user->user_lastname ) ? $current_user->user_lastname : ''; 187 $name = trim( $firstname." ".$lastname ); 188 } else if ( !empty( $current_user->display_name ) ){ 189 $name = trim( $current_user->display_name ); 190 } else { 191 $name = trim( $current_user->user_login ); 192 } 193 194 printf( __( "<div class='notice notice-success is-dismissible'><p>Hi<b> %s </b><br>Congratulations on collecting 10 reviews,<br>We hope our plugin has been helpful. If you're enjoying this plugin, please help us by leaving a positive review on the WordPress plugin repository. It helps us to grow and continue to create a better platform.<br>Thanks - Mike</p></div>", "reviews-sorted" ), $name ); 195 }
Note: See TracChangeset
for help on using the changeset viewer.