[wp-meta] [Making WordPress.org] #7177: Allow Seemingly Anonymous forum post Edits

Making WordPress.org noreply at wordpress.org
Tue Aug 8 03:51:42 UTC 2023


#7177: Allow Seemingly Anonymous forum post Edits
----------------------------+---------------------
 Reporter:  Ipstenu         |       Owner:  (none)
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:
Component:  Support Forums  |  Resolution:
 Keywords:  has-patch       |
----------------------------+---------------------

Comment (by dd32):

 > Would this also mean though that authors wouldn't see their OWN edits?
 > Would I just see "Modified X time ago" and nothing else?

 With the above, yes. That's part of the simplification of the filtering.

 I'm not sure that would be a problem though, but I understand why it might
 be ideal to specifically tell posters that an edit was ''them''.

 There was a "simpler" solution which was to just reassign the ownership of
 the revisions to the moderator, but that came with it's own problems like
 https://bbpress.trac.wordpress.org/ticket/3579

 Going down that path, it's also possible to use a much lower-level filter,
 `post_author` hopefully temporarily until the above ticket is resolved,
 ie:
 [[Image(https://meta.trac.wordpress.org/raw-
 attachment/ticket/7177/Screenshot%202023-08-08%20at%201.47.51%20pm.png)]]

 I'm not super confident in that filter though, as I'd be concerned about
 side effects..
 {{{
 add_filter( 'post_author', function( $author, $post_id, $context ) {
         if ( 'display' != $context || is_admin() || current_user_can(
 'moderate' ) ) {
                 return $author;
         }

         $post = get_post( $post_id );
         if ( 'revision' != $post->post_type || ! $post->post_parent ) {
                 return $author;
         }

         $parent = get_post( $post->post_parent );
         if ( ! $parent || ! in_array( $parent->post_type, [ 'reply',
 'topic' ] ) ) {
                 return $author;
         }

         if ( $author != $parent->post_author ) {
                 $author = get_user_by( 'slug', 'moderator')->ID;
         }

         return $author;
 }, 10, 3 );
 }}}

-- 
Ticket URL: <https://meta.trac.wordpress.org/ticket/7177#comment:8>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org


More information about the wp-meta mailing list