Making WordPress.org


Ignore:
Timestamp:
10/19/2018 10:56:22 PM (6 years ago)
Author:
coffee2code
Message:

developer.wordpress.org: Allow users to edit their own submitted notes that are still in moderation.

Props keesiemeijer.
Fixes #3572.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments.php

    r6910 r7754  
    4646                    $ordered_comments = wporg_developer_get_ordered_notes();
    4747                    if ( $ordered_comments ) {
    48                         $feedback_editor = array_filter(  wp_list_pluck( $ordered_comments, 'show_editor') );
    4948                        wporg_developer_list_notes( $ordered_comments, array( 'avatar_size' => 32 ) );
    5049                    }
     
    6564    <?php if ( \DevHub\is_parsed_post_type() && DevHub\can_user_post_note( true, get_the_ID() ) ) : ?>
    6665
    67         <?php $add_note_style = empty( $feedback_editor ) ? 'display:none;' : ''; ?>
    68         <p id="add-user-note" style="<?php echo $add_note_style; ?>"><a href="<?php echo user_trailingslashit( get_permalink() ) . '#respond'; ?>"><?php _e( 'Have a note or feedback to contribute?', 'wporg' ); ?></a></p>
     66        <?php if ( is_user_logged_in() ) : ?>
     67            <?php
     68                /* Hide the add user note link by default.
     69                 * It will be displayed by Javascript.
     70                 * If Javascript is disabled the comment form is displayed and the link stays hidden.
     71                 */
     72            ?>
     73            <p id="add-user-note" style="display: none;"><a href="<?php echo user_trailingslashit( get_permalink() ) . '#respond'; ?>"><?php _e( 'Have a note or feedback to contribute?', 'wporg' ); ?></a></p>
     74        <?php endif; ?>
    6975
    7076        <?php
    71         $args = array(
    72             'logged_in_as'        => '<p class="logged-in-as">'
    73                 . sprintf(
    74                     /* translators: 1: user profile link, 2: accessibility text, 3: user name, 4: logout URL */
    75                     __( '<a href="%1$s" aria-label="%2$s">Logged in as %3$s</a>. <a href="%4$s">Log out?</a>' ),
    76                     'https://profiles.wordpress.org/' . esc_attr( wp_get_current_user()->user_nicename ),
    77                     /* translators: %s: user name */
    78                     esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ),
    79                     $user_identity,
    80                     wp_logout_url( apply_filters( 'the_permalink', get_permalink() ) )
    81                 )
    82                 . '</p><p><ul><li>'
    83                 . __( 'Notes should supplement code reference entries, for example examples, tips, explanations, use-cases, and best practices.', 'wporg' )
    84                 . '</li><li>'
    85                 . __( 'Feedback can be to report errors or omissions with the documentation on this page. Such feedback will not be publicly posted.', 'wporg' )
    86                 . '</li><li>'
    87                 /* translators: 1: php button, 2: js button, 3: inline code button */
    88                 . sprintf(
    89                     __( 'You can enter text and code. Use the %1$s, %2$s, or %3$s buttons to wrap code snippets.', 'wporg' ),
    90                     '<span class="text-button">php</span>',
    91                     '<span class="text-button">js</span>',
    92                     '<span class="text-button">' . __( 'inline code', 'wporg' ) . '</span>'
    93                 )
    94                 . '</li></ul></p>',
    95             'comment_notes_after' => '<p>'
    96                 . __( 'Submission Notes:', 'wporg' )
    97                 . '<ul><li>'
    98                 . __( 'This form is not for support requests, discussions, spam, bug reports, complaints, or self-promotion. Entries of this nature will be deleted.', 'wporg' )
    99                 . '</li><li>'
    100                 . __( 'In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.', 'wporg' )
    101                 . '</li><li class="user-notes-are-gpl">'
    102                 . sprintf(
    103                     /* translators: 1: GFDL link */
    104                     __( '<strong>NOTE:</strong> All contributions are licensed under %s and are moderated before appearing on the site.', 'wporg' ),
    105                     '<a href="https://gnu.org/licenses/fdl.html">GFDL</a>'
    106                 )
    107                 . '</li></ul></p>',
    108             'label_submit'        => __( 'Add Note or Feedback', 'wporg' ),
    109             'cancel_reply_link'   => '',
    110             'must_log_in'         => '<p>' . sprintf(
    111                 __( 'You must <a href="%s">log in</a> before being able to contribute a note or feedback.', 'wporg' ),
    112                 'https://login.wordpress.org/?redirect_to=' . urlencode( get_comments_link() )
    113             ) . '</p>',
    114             'title_reply'         => '', //'Add Example'
    115             'title_reply_to'      => '',
    116         );
    117 
    118         if ( class_exists( 'DevHub_Note_Preview' ) ) {
    119             $args['comment_notes_after'] = DevHub_Note_Preview::comment_preview() . $args['comment_notes_after'];
    120             $args['class_form']          = 'comment-form tab-container';
    121         }
    122 
    123         if ( class_exists( 'DevHub_User_Submitted_Content' ) ) {
    124             $args['comment_field'] = DevHub_User_Submitted_Content::wp_editor_comments();
    125         }
    126 
    127         // Insert comment form if feedback form is not already used.
    128         if ( empty( $feedback_editor ) ) {
     77        if ( class_exists( 'DevHub_User_Submitted_Content' ) )  {
     78            $args = \DevHub_User_Submitted_Content::comment_form_args();
    12979            comment_form( $args );
    13080        }
Note: See TracChangeset for help on using the changeset viewer.