Changeset 14037
- Timestamp:
- 09/10/2024 05:30:16 AM (4 weeks ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/post-meta.php
r14012 r14037 29 29 */ 30 30 function register() { 31 register_course_meta(); 31 32 register_lesson_meta(); 32 33 register_lesson_plan_meta(); 33 34 register_workshop_meta(); 34 35 register_misc_meta(); 36 } 37 38 /** 39 * Register post meta keys for courses. 40 */ 41 function register_course_meta() { 42 register_post_meta( 43 'course', 44 '_course_completion_success_message', 45 array( 46 'description' => __( 'The message displayed to users upon successful course completion.', 'wporg-learn' ), 47 'type' => 'string', 48 'single' => true, 49 'sanitize_callback' => 'sanitize_text_field', 50 'show_in_rest' => true, 51 'auth_callback' => function( $allowed, $meta_key, $post_id ) { 52 return current_user_can( 'edit_post', $post_id ); 53 }, 54 ) 55 ); 56 57 register_post_meta( 58 'course', 59 '_course_completion_survey_link', 60 array( 61 'description' => __( 'The survey link to be shown alongside the completion message.', 'wporg-learn' ), 62 'type' => 'string', 63 'single' => true, 64 'default' => '', 65 'sanitize_callback' => 'esc_url_raw', 66 'show_in_rest' => true, 67 'auth_callback' => function( $allowed, $meta_key, $post_id ) { 68 return current_user_can( 'edit_post', $post_id ); 69 }, 70 ) 71 ); 35 72 } 36 73 … … 656 693 enqueue_lesson_featured_meta_assets(); 657 694 enqueue_duration_meta_assets(); 695 enqueue_course_completion_meta_assets(); 658 696 } 659 697 … … 761 799 } 762 800 } 801 802 /** 803 * Enqueue scripts for the course completion meta block. 804 */ 805 function enqueue_course_completion_meta_assets() { 806 global $typenow; 807 808 if ( 'course' === $typenow ) { 809 $script_asset_path = get_build_path() . 'course-completion-meta.asset.php'; 810 if ( ! file_exists( $script_asset_path ) ) { 811 wp_die( 'You need to run `yarn start` or `yarn build` to build the required assets.' ); 812 } 813 814 $script_asset = require( $script_asset_path ); 815 wp_enqueue_script( 816 'wporg-learn-course-completion-meta', 817 get_build_url() . 'course-completion-meta.js', 818 $script_asset['dependencies'], 819 $script_asset['version'], 820 true 821 ); 822 823 wp_set_script_translations( 'wporg-learn-course-completion-meta', 'wporg-learn' ); 824 } 825 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/webpack.config.js
r13981 r14037 5 5 */ 6 6 config.entry = { 7 'course-completion-meta': './js/course-completion-meta/index.js', 7 8 'course-status': './js/course-status/src/index.js', 8 9 'duration-meta': './js/duration-meta/index.js', -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/patterns/page-course-complete-content.php
r13878 r14037 5 5 * Inserter: no 6 6 */ 7 8 $course_id = isset( $_GET['course_id'] ) ? intval( $_GET['course_id'] ) : get_the_ID(); 9 $success_message = get_post_meta( $course_id, '_course_completion_success_message', true ) ?: __( 'Congratulations on completing this course!', 'wporg-learn' ); 10 $survey_link = get_post_meta( $course_id, '_course_completion_survey_link', true ) ?: 'https://docs.google.com/forms/d/e/1FAIpQLSf0QMflUedxjta0u5qS4_pl-9aY06BDBXgRn2PoZA1gRvD9jw/viewform'; 7 11 8 12 ?> … … 16 20 <!-- wp:heading {"style":{"spacing":{"margin":{"top":"40px","bottom":"10px"}}},"fontSize":"large","fontFamily":"inter"} --> 17 21 <h2 class="wp-block-heading has-inter-font-family has-large-font-size" style="margin-top:40px;margin-bottom:10px"> 18 <?php e sc_html_e( 'Congratulations on completing this course!', 'wporg-learn'); ?>22 <?php echo esc_html( $success_message ); ?> 19 23 </h2> 20 24 <!-- /wp:heading --> … … 30 34 <!-- wp:button {"style":{"spacing":{"padding":{"left":"32px","right":"32px","top":"17px","bottom":"17px"}}}} --> 31 35 <div class="wp-block-button"> 32 <a class="wp-block-button__link wp-element-button" href=" https://docs.google.com/forms/d/e/1FAIpQLSf0QMflUedxjta0u5qS4_pl-9aY06BDBXgRn2PoZA1gRvD9jw/viewform" style="padding-top:17px;padding-right:32px;padding-bottom:17px;padding-left:32px">36 <a class="wp-block-button__link wp-element-button" href="<?php echo esc_url( $survey_link ); ?>" style="padding-top:17px;padding-right:32px;padding-bottom:17px;padding-left:32px"> 33 37 <?php esc_html_e( 'Complete the survey', 'wporg-learn' ); ?> 34 38 </a> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/style.css
r14032 r14037 5 5 * Author URI: http://wordpress.org/ 6 6 * Description: A theme for learn.wordpress.org, built in 2024. 7 * Version: 1.0.0- 6616fa57 * Version: 1.0.0-bcce0c1 8 8 * License: GNU General Public License v2 or later 9 9 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.