Making WordPress.org

Ticket #5706: 5706.patch

File 5706.patch, 3.4 KB (added by Clorith, 4 years ago)
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-report-topic.php

    diff --git a/sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-report-topic.php b/sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-report-topic.php
    a b  
    105105                        remove_action( 'set_object_terms', array( $this, 'detect_manual_modlook' ), 10 );
    106106                        wp_add_object_terms( $_POST['wporg-support-report-topic'], 'modlook', 'topic-tag' );
    107107
    108                         $reason = $_POST['topic-report-reason'];
    109 
    110                         if ( 'other-input' === $reason ) {
    111                                 $reason = $_POST['topic-report-reason-other'];
    112                         }
     108            $reason = sprintf(
     109                '%s: %s',
     110                $_POST['topic-report-reason'],
     111                $_POST['topic-report-reason-details']
     112            );
    113113
    114114                        $this->add_modlook_history( $_POST['wporg-support-report-topic'], $reason );
    115115
     
    172172                                <input type="hidden" name="wporg-support-report-topic" value="<?php echo esc_attr( bbp_get_topic_id() ); ?>">
    173173
    174174                                <label for="topic-report-reason"><?php _e( 'Report this topic for:', 'wporg-forums' ); ?></label>
    175                                 <select name="topic-report-reason" id="topic-report-reason" required="required" onchange="wporg_report_topic_change()">
     175                                <select name="topic-report-reason" id="topic-report-reason" required="required">
    176176                                        <option value=""><?php _ex( '&mdash; Choose one &mdash;', 'Report a topic reason', 'wporg-forums' ); ?></option>
    177177                                        <option><?php _ex( 'Guideline violation', 'Report a topic reason', 'wporg-forums' ); ?></option>
    178178                                        <option><?php _ex( 'Security related', 'Report a topic reason', 'wporg-forums' ); ?></option>
     
    180180                                        <option><?php _ex( 'NSFW (Not Safe For Work) link', 'Report a topic reason', 'wporg-forums' ); ?></option>
    181181                                        <option value="other-input"><?php _ex( 'Other', 'Report a topic reason', 'wporg-forums' ); ?></option>
    182182                                </select>
    183                                 <aside id="report-topic-other" style="display: none;">
    184                                         <label for="topic-report-reason-other"><?php _e( 'Your own reason:', 'wporg-forums' ); ?></label>
    185                                         <input type="text" name="topic-report-reason-other" id="topic-report-reason-other">
     183                                <aside id="report-topic-other">
     184                                        <label for="topic-report-reason-details"><?php _e( 'Why are you reporting this topic:', 'wporg-forums' ); ?></label>
     185                                        <input type="text" name="topic-report-reason-details" id="topic-report-reason-details" required="required">
    186186                                </aside>
    187187                                <input type="submit" name="submit" value="<?php esc_attr_e( 'Report', 'wporg-forums' ); ?>">
    188188                        </form>
    189 
    190             <script type="text/javascript">
    191                 function wporg_report_topic_change() {
    192                         if ( 'other-input' === document.getElementById('topic-report-reason').value ) {
    193                                 document.getElementById( 'report-topic-other' ).style.display = 'block';
    194                     } else {
    195                                                 document.getElementById( 'report-topic-other' ).style.display = 'none';
    196                     }
    197                 }
    198             </script>
    199189<?php
    200190                        $report_text = ob_get_clean();
    201191                }