+ + + + + + + +
+ + +Index: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments-edit.php =================================================================== --- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments-edit.php (nonexistent) +++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments-edit.php (working copy) @@ -0,0 +1,90 @@ +comment_parent ? true : false; +$parent = $is_parent ? get_comment( $comment->comment_parent ) : false; +$post_url = get_permalink( $post_id ); +$post_title = single_post_title( '', false ); +$post_types = get_parsed_post_types( 'labels' ); +$type_single = get_post_type_object( $post->post_type )->labels->singular_name; +$type_url = get_post_type_archive_link( $post->post_type ); +$type_label = $post_types[ $post->post_type ]; +$ref_url = get_site_section_url(); +$ref_link = "Reference"; +$post_link = "{$post_title}"; +$note_link = "note {$comment_id}"; +$type_link = "{$type_label}"; + +$parent_link = ''; +$parent_author = ''; +if ( $is_parent && isset( $parent->comment_ID ) ) { + $parent_author = get_note_author_link( $parent ); + $parent_label = sprintf( __('note %d', 'wporg'), $parent->comment_ID ); + $parent_link = "{$parent_label}"; +} + +add_filter( 'breadcrumb_trail_items', function($items) use ( $ref_link, $type_link, $post_link, $note_link ) { + $items[] = $ref_link; + $items[] = $type_link; + $items[] = $post_link; + $items[] = $note_link; + $items[] = __('Edit', 'wporg'); + return $items; +} ); +?> + +
+ + + + + + + +
+ + +' - . sprintf( - /* translators: 1: user profile link, 2: accessibility text, 3: user name, 4: logout URL */ - __( 'Logged in as %3$s. Log out?' ), - 'https://profiles.wordpress.org/' . esc_attr( wp_get_current_user()->user_nicename ), - /* translators: %s: user name */ - esc_attr( sprintf( __( 'Logged in as %s. Edit your profile.' ), $user_identity ) ), - $user_identity, - wp_logout_url( apply_filters( 'the_permalink', get_permalink() ) ) - ) - . '
' - . __( 'Submission Notes:', 'wporg' ) - . '
' . sprintf( - __( 'You must log in before being able to contribute a note or feedback.', 'wporg' ), - 'https://login.wordpress.org/?redirect_to=' . urlencode( get_comments_link() ) - ) . '
', - 'title_reply' => '', //'Add Example' - 'title_reply_to' => '', - ); - - if ( class_exists( 'DevHub_Note_Preview' ) ) { - $args['comment_notes_after'] = DevHub_Note_Preview::comment_preview() . $args['comment_notes_after']; - $args['class_form'] = 'comment-form tab-container'; - } - - if ( class_exists( 'DevHub_User_Submitted_Content' ) ) { - $args['comment_field'] = DevHub_User_Submitted_Content::wp_editor_comments(); - } - - // Insert comment form if feedback form is not already used. - if ( empty( $feedback_editor ) ) { + if ( class_exists( 'DevHub_User_Submitted_Content' ) ) { + $args = \DevHub_User_Submitted_Content::comment_form_args(); comment_form( $args ); } ?> Index: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php =================================================================== --- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php (revision 7145) +++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/functions.php (working copy) @@ -56,6 +56,11 @@ require __DIR__ . '/inc/user-content-voting.php'; /** + * Editing for user-submitted content. + */ +require __DIR__ . '/inc/user-content-edit.php'; + +/** * CLI commands custom post type and importer. */ require __DIR__ . '/inc/cli.php'; Index: sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php =================================================================== --- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php (revision 7145) +++ sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php (working copy) @@ -113,7 +113,11 @@ // Check if the current page is a reply to a note. $reply_id = 0; - if ( isset( $_GET['replytocom'] ) && $_GET['replytocom'] ) { + if ( isset( $_GET['replytocom'] ) && $_GET['replytocom'] ) { + /* Javascript uses preventDefault() when clicking links with '?replytocom={comment_ID}' + * We assume Javascript is disabled when visiting a page with this query var. + * There are no consequences if Javascript is enabled. + */ $reply_id = absint( $_GET['replytocom'] ); } @@ -142,8 +146,11 @@ $comments[ $key ]->child_notes = array_reverse( $children[ $comment->comment_ID ] ); } - if ( ! $show_editor && ( $reply_id && ( $reply_id === (int) $comment->comment_ID ) ) ) { - // Show the editor when replying to this parent comment + if ( ! $show_editor && ( $reply_id && ( $reply_id === (int) $comment->comment_ID ) ) ) { + /* The query var 'replytocom' is used and the value is the same as the current comment ID. + * We show the editor for the current comment because we assume Javascript is disabled. + * If Javascript is not disabled the editor is hidden (as normal) by the class 'hide-if-js'. + */ $comments[ $key ]->show_editor = true; $show_editor = true; } @@ -164,10 +171,15 @@ * @param array $args Comment display arguments. */ function wporg_developer_list_notes( $comments, $args ) { + $is_user_content = class_exists( 'DevHub_User_Submitted_Content' ); $is_user_logged_in = is_user_logged_in(); $can_user_post_note = DevHub\can_user_post_note( true, get_the_ID() ); - $user_content = class_exists( 'DevHub_User_Submitted_Content' ); - $display_editor = $is_user_logged_in && $can_user_post_note && $user_content; + $is_user_verified = $is_user_logged_in && $can_user_post_note; + + $args['updated_note'] = 0; + if ( isset( $_GET['updated-note'] ) && $_GET['updated-note'] ) { + $args['updated_note'] = absint( $_GET['updated-note'] ); + } foreach ( $comments as $comment ) { @@ -176,9 +188,10 @@ // Display parent comment. wporg_developer_user_note( $comment, $args, 1 ); - // Show or hide feedback notes. - $class = $comment->show_editor ? '' : ' hide-if-js'; - echo "