安裝的翻譯插件提示Your TranslatePress serial number is invalid or missing. Please register your copy to receive access to automatic updates and support. Need a license key
處理的方式如下,針對2.16版有效
打開 wp-content\plugins\translatepress-multilingual\includes\class-plugin-notices.php
刪除347-621之間下面的內容
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
/* License Notifications */ $license_details = get_option( 'trp_license_details' ); $is_demosite = ( strpos(site_url(), 'https://demo.translatepress.com' ) !== false ); if( !empty($license_details) && !$is_demosite){ /* if we have any invalid response for any of the addon show just the error notification and ignore any valid responses */ if( !empty( $license_details['invalid'] ) ){ //take the first addon details (it should be the same for the rest of the invalid ones) $license_detail = $license_details['invalid'][0]; /* this must be unique */ $notification_id = 'trp_invalid_license'; $message = '<p style="padding-right:30px;">'; if( $license_detail->error == 'missing' ) $message .= '<p>'. sprintf( __('Your <strong>TranslatePress</strong> serial number is invalid or missing. <br/>Please %1$sregister your copy%2$s to receive access to automatic updates and support. Need a license key? %3$sPurchase one now%4$s' , 'translatepress-multilingual' ), "<a href='". admin_url('/admin.php?page=trp_license_key') ."'>", "</a>", "<a href='https://translatepress.com/pricing/?utm_source=TP&utm_medium=dashboard&utm_campaign=TP-SN-Purchase' target='_blank' class='button-primary'>", "</a>" ).'</p>'; elseif( $license_detail->error == 'expired' ) $message .= '<p>'. sprintf( __('Your <strong>TranslatePress</strong> license has expired. <br/>Please %1$sRenew Your Licence%2$s to continue receiving access to product downloads, automatic updates and support. %3$sRenew now %4$s' , 'translatepress-multilingual' ), "<a href='https://www.translatepress.com/account/?utm_source=TP&utm_medium=dashboard&utm_campaign=TP-Renewal' target='_blank'>", "</a>", "<a href='https://www.translatepress.com/account/?utm_source=TP&utm_medium=dashboard&utm_campaign=TP-Renewal' target='_blank' class='button-primary'>", "</a>" ). '</p>'; else $message .= '<p>' . __( 'Something went wrong, please try again.', 'translatepress-multilingual' ) . '</p>'; $message .= '</p>'; if( !$notifications->is_plugin_page() ) { //make sure to use the trp_dismiss_admin_notification arg $message .= '<a style="text-decoration: none;z-index:100;" href="' . add_query_arg(array('trp_dismiss_admin_notification' => $notification_id)) . '" type="button" class="notice-dismiss"><span class="screen-reader-text">' . __('Dismiss this notice.', 'translatepress-multilingual') . '</span></a>'; } $notifications->add_notification( $notification_id, $message, 'trp-notice notice error is-dismissible', true, array('translate-press'), true); } elseif( !empty( $license_details['valid'] ) ){ //take the first addon details (it should be the same for the rest of the valid ones) $license_detail = $license_details['valid'][0]; if( isset($license_detail->auto_billing) && !$license_detail->auto_billing ) {//auto_billing was added by us in a filter on translatepress.com if ((strtotime($license_detail->expires) - time()) / (60 * 60 * 24) < 30) { /* this must be unique */ $notification_id = 'trp_will_expire_license'; $message = '<p style="padding-right:30px;">' . sprintf( __( 'Your <strong>TranslatePress</strong> license will expire on %1$s. Please %2$sRenew Your Licence%3$s to continue receiving access to product downloads, automatic updates and support.', 'translatepress-multilingual'), date_i18n( get_option( 'date_format' ), strtotime( $license_detail->expires, current_time( 'timestamp' ) ) ), '<a href="https://translatepress.com/account/?utm_source=TP&utm_medium=dashboard&utm_campaign=TP-Renewal" target="_blank">', '</a>'). '</p>'; if (!$notifications->is_plugin_page()) { //make sure to use the trp_dismiss_admin_notification arg $message .= '<a style="text-decoration: none;z-index:100;" href="' . add_query_arg(array('trp_dismiss_admin_notification' => $notification_id)) . '" type="button" class="notice-dismiss"><span class="screen-reader-text">' . __('Dismiss this notice.', 'translatepress-multilingual') . '</span></a>'; } $notifications->add_notification($notification_id, $message, 'trp-notice notice notice-info is-dismissible', true, array('translate-press'), true); } } } } |
更新wp-content\plugins\translatepress-multilingual\includes\class-edd-sl-plugin-updater.php第608-621之間的內容為以下內容:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
// make sure the response came back okay if (!is_wp_error($response)) { $license_data = json_decode(wp_remote_retrieve_body($response)); $license_data->success = true; $license_data->error = ''; $license_data->expires = date('Y-m-d', strtotime('+50 years')); $license_data->license = 'valid'; //if (false === $license_data->success) { // $license_information_for_all_addons['invalid'][] = $license_data; // break;//we only need one failure //} else { $license_information_for_all_addons['valid'][] = $license_data; //} } |
608-621之間的原文為
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
// make sure the response came back okay if (!is_wp_error($response)) { $license_data = json_decode(wp_remote_retrieve_body($response)); $license_data->success = true; $license_data->error = ''; $license_data->expires = date('Y-m-d', strtotime('+50 years')); $license_data->license = 'valid'; if (false === $license_data->success) { $license_information_for_all_addons['invalid'][] = $license_data; break;//we only need one failure } else { $license_information_for_all_addons['valid'][] = $license_data; } |
translatepress-multilingual-2.16.zh_CN