Changeset 1477390
- Timestamp:
- 08/17/2016 11:41:16 PM (10 years ago)
- Location:
- video-capture/trunk
- Files:
-
- 3 edited
-
settings.php (modified) (10 diffs)
-
templates/settings.php (modified) (1 diff)
-
wp-video-capture.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
video-capture/trunk/settings.php
r1477386 r1477390 32 32 33 33 // Register actions. 34 add_action( 'admin_init', array( &$this, 'hide_ registration_notice' ) );34 add_action( 'admin_init', array( &$this, 'hide_email_notification_notice' ) ); 35 35 add_action( 'admin_init', array( &$this, 'hide_pro_activation_notice' ) ); 36 36 add_action( 'admin_init', array( &$this, 'admin_init' ) ); … … 46 46 public function validate_email( $email ) { 47 47 if ( ! is_email( $email ) && '' !== $email ) { 48 add_settings_error( 'vidrack_ pro_account_email', 'video-capture-invalid-email', 'Please enter a correct email' );48 add_settings_error( 'vidrack_notifications_email', 'video-capture-invalid-email', 'Please enter a correct email' ); 49 49 } else { 50 // Register user. 51 $this->video_capture_email->register_user( $email ); 50 52 return $email; 51 53 } … … 58 60 public function notifications_email_notice() { 59 61 printf( 60 '<div class="update d"><p>%1$s <input type="button" class="button" value="%3$s" onclick="document.location.href=\'%2$s\';" /></div>',61 ' Your Vidrack Pro subscription successfully activated!',62 '<div class="update-nag"><p>%1$s <input type="button" class="button" value="%3$s" onclick="document.location.href=\'%2$s\';" /></div>', 63 'Please enter your email to get notifications about newly uploaded videos', 62 64 esc_url( add_query_arg( 'wp-video-capture-nag', wp_create_nonce( 'wp-video-capture-nag' ) ) ), 63 65 'Dismiss' … … 66 68 67 69 /** 68 * Hide registration noticeupon click.69 */ 70 public function hide_ registration_notice() {70 * Hide email notification upon click. 71 */ 72 public function hide_email_notification_notice() { 71 73 if ( ! isset( $_GET['wp-video-capture-nag'] ) ) { // Input var "wp-video-capture-nag" is not set. 72 74 return; … … 77 79 78 80 // Update user meta to indicate dismissed notice. 79 update_user_meta( get_current_user_id(), '_wp-video-capture_hide_ registration_notice', true );81 update_user_meta( get_current_user_id(), '_wp-video-capture_hide_email_notification_notice', true ); 80 82 } 81 83 … … 108 110 109 111 /** 112 * Send email upon registration. 113 */ 114 public function pro_activation_success_notice() { 115 printf( 116 '<div class="updated"><p>%1$s</div>', 117 'Vidrack Pro version successfully activated!' 118 ); 119 } 120 121 /** 110 122 * Main pro settings init function. 111 123 */ … … 117 129 && 'edit.php' === $pagenow 118 130 && 'wp_video_capture_settings' === $_GET['page'] // Input var "page" is set. 119 && ! get_user_meta( get_current_user_id(), '_wp-video-capture_hide_registration_notice', true ) ) { 120 121 // Register user. 122 $this->video_capture_email->register_user( get_option( 'vidrack_pro_account_email' ) ); 123 add_action( 'admin_notices', array( &$this, 'notifications_email_notice' ) ); 124 update_user_meta( get_current_user_id(), '_wp-video-capture_hide_registration_notice', true ); 131 && ! get_user_meta( get_current_user_id(), '_wp-video-capture_hide_pro_activation_success_notice', true ) ) { 132 133 add_action( 'admin_notices', array( &$this, 'pro_activation_success_notice' ) ); 134 135 update_user_meta( get_current_user_id(), '_wp-video-capture_hide_pro_activation_success_notice', true ); 125 136 } 126 137 … … 269 280 270 281 // Display notice about Pro activation. 271 if ( ! $this->pro_account && ('vidrack_video' === $_GET['post_type'] || 'wp_video_capture_settings' === $_GET['page'] ) // Input var "page" is set. 272 && ! get_user_meta( get_current_user_id(), '_wp-video-capture_hide_pro_activation_notice', true ) ) { 273 add_action( 'admin_notices', array( &$this, 'pro_activation_notice' ) ); 274 } 282 if ( 'vidrack_video' === $_GET['post_type'] || 'wp_video_capture_settings' === $_GET['page'] ) { // Input var "page" is set. 283 if( ! $this->pro_account && ! get_user_meta( get_current_user_id(), '_wp-video-capture_hide_pro_activation_notice', true ) ) { 284 add_action( 'admin_notices', array( &$this, 'pro_activation_notice' ) ); 285 } 286 if( ! get_option( 'vidrack_notifications_email' ) && ! get_user_meta( get_current_user_id(), '_wp-video-capture_hide_email_notification_notice', true ) ) { 287 add_action( 'admin_notices', array( &$this, 'notifications_email_notice' ) ); 288 } 289 } 290 291 // Register and validate Mail options. 292 register_setting( 'wp_video_capture-group', 'vidrack_notifications_email', array( &$this, 'validate_email' ) ); 275 293 276 294 // Register Pro account options. 277 295 register_setting( 'wp_video_capture-group', 'vidrack_pro_account_key' ); 278 register_setting( 'wp_video_capture-group', 'vidrack_pro_account_email' , array( &$this, 'validate_email' ));296 register_setting( 'wp_video_capture-group', 'vidrack_pro_account_email' ); 279 297 280 298 register_setting( 'wp_video_capture-group', 'vidrack_js_callback' ); … … 291 309 ); 292 310 311 add_settings_section( 312 'wp_video_capture-section-email', 313 'Notifications Email Settings', 314 array( &$this, 'settings_section_wp_video_capture_email' ), 315 'wp_video_capture-email' 316 ); 317 293 318 // Add your settings section. 294 319 add_settings_section( … … 356 381 array( 357 382 'field' => 'vidrack_window_modal', 383 ) 384 ); 385 386 // Add email setting field. 387 add_settings_field( 388 'wp_video_capture-notifications_email', 389 'Notifications email', 390 array( &$this, 'settings_field_input_text' ), 391 'wp_video_capture-email', 392 'wp_video_capture-section-email', 393 array( 394 'field' => 'vidrack_notifications_email', 358 395 ) 359 396 ); -
video-capture/trunk/templates/settings.php
r1477388 r1477390 18 18 <?php do_settings_sections( 'wp_video_capture_pro' ); ?> 19 19 <?php do_settings_sections( 'wp_video_capture' ); ?> 20 <?php do_settings_sections( 'wp_video_capture-email' ); ?> 20 21 <?php do_settings_sections( 'wp_video_capture-youtube' ); ?> 21 22 <?php do_settings_sections( 'wp_video_capture-collect' ); ?> -
video-capture/trunk/wp-video-capture.php
r1477389 r1477390 130 130 add_action( 'admin_notices', array( $this, 'notice_validation_pro_account' ) ); 131 131 } 132 add_action( 'admin_init', array( $this, 'hide_ registration_notice' ) );132 add_action( 'admin_init', array( $this, 'hide_pro_activation_success_notice' ) ); 133 133 return false; 134 134 } … … 157 157 */ 158 158 function hide_registration_notice() { 159 update_user_meta( get_current_user_id(), '_wp-video-capture_hide_ registration_notice', false );159 update_user_meta( get_current_user_id(), '_wp-video-capture_hide_pro_activation_success_notice', false ); 160 160 } 161 161 … … 241 241 add_option( 'vidrack_collect_language', 'no' ); 242 242 add_option( 'vidrack_version', self::$vidrack_version ); 243 244 // Add user config.245 add_user_meta( get_current_user_id(), '_wp-video-capture_hide_registration_notice', false, true );246 243 } 247 244 … … 640 637 } else { 641 638 // Send email notification. 642 if ( $t his->pro_account && $to = get_option( 'vidrack_pro_account_email' )) {639 if ( $to = get_option( 'vidrack_notifications_email' ) ) { 643 640 $this->video_capture_email->send_new_video_email( $to, sanitize_text_field( wp_unslash( $_POST['filename'] ) ) ); // Input var "filename" is set. 644 641 }
Note: See TracChangeset
for help on using the changeset viewer.