WordPress.org

Making WordPress.org

Ticket #1513: iagree.diff

File iagree.diff, 1.9 KB (added by rabmalin, 4 years ago)

Adding I agree checkbox

  • wordpress.org/public_html/wp-content/plugins/theme-directory/upload.php

    diff --git a/wordpress.org/public_html/wp-content/plugins/theme-directory/upload.php b/wordpress.org/public_html/wp-content/plugins/theme-directory/upload.php
    index 690827f..b047c60 100644
    a b function wporg_themes_render_upload_shortcode() { 
    2020        if ( is_user_logged_in() ) :
    2121
    2222                if ( ! empty( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'wporg-themes-upload' ) && 'upload' === $_POST['action'] ) {
    23                         $message = wporg_themes_process_upload(); 
     23                        $message = wporg_themes_process_upload();
    2424
    2525                        if ( ! empty( $message ) ) {
    2626                                echo "<div class='notice notice-warning'><p>{$message}</p></div>\n";
    function wporg_themes_render_upload_shortcode() { 
    3232                        <?php wp_nonce_field( 'wporg-themes-upload' ); ?>
    3333                        <input type="hidden" name="action" value="upload"/>
    3434                        <input type="file" id="zip_file" name="zip_file" size="25"/>
     35                        <br />
     36                        <input type="checkbox" id="i_agree" name="i_agree" value="1" /> <?php printf( esc_html__( 'I agree to all the terms and conditions set by the %s.', 'wporg-themes' ), '<a href="https://make.wordpress.org/themes/handbook/review/required/">' . esc_html__( 'theme guidelines', 'wporg-themes' ) . '</a>' ); ?>
     37                        <br />
    3538                        <input id="upload_button" class="button" type="submit" value="<?php esc_attr_e( 'Upload', 'wporg-themes' ); ?>"/>
    3639
    3740                        <p>
    function wporg_themes_process_upload( ) { 
    8487                return __( 'Error in file upload.', 'wporg-themes' );
    8588        }
    8689
     90        if ( ! isset( $_REQUEST['i_agree'] ) || 1 !== absint( $_REQUEST['i_agree'] ) ) {
     91                return __( 'You must agree to the terms.', 'wporg-themes' );
     92        }
     93
    8794        if ( ! class_exists( 'WPORG_Themes_Upload' ) ) {
    8895                include_once plugin_dir_path( __FILE__ ) . 'class-wporg-themes-upload.php';
    8996        }