Skip to:
Content

bbPress.org

Opened 2 years ago

Last modified 2 months ago

#3579 assigned defect (bug)

$author_id in bbp_get_*_revision_log() not respected

Reported by: dd32's profile dd32 Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.1
Component: API - Moderation Keywords: has-patch needs-testing
Cc:

Description

bbp_get_reply_revision_log() + bbp_get_topic_revision_log() allows for a revisions author_id to come from the revision meta, however, the function doesn't actually use this saved data at all, instead always using the revisions authorship details.

See https://github.com/bbpress/bbPress/blob/4178cbf665674c128c928fabdc0322badacad06b/src/includes/replies/template.php#L751-L759 + https://github.com/bbpress/bbPress/blob/4178cbf665674c128c928fabdc0322badacad06b/src/includes/topics/template.php#L915-L923

Discovered while working on https://meta.trac.wordpress.org/ticket/7177

The simplest way to reproduce this is to filter bbp_get_reply_raw_revision_log setting the author ID to something different than saved in the DB, and you'll find the output references the original revisions author.

Change History (4)

#1 @johnjamesjacoby
22 months ago

  • Component changed from API to API - Moderation
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 2.7
  • Owner set to johnjamesjacoby
  • Status changed from new to assigned
  • Version set to 2.1

This ticket was mentioned in PR #34 on bbpress/bbPress by @rollybueno.


6 months ago
#2

  • Keywords has-patch added; needs-patch removed

### Summary

This PR fixes an issue where bbp_get_reply_revision_log() and bbp_get_topic_revision_log() would always display the original revision author, even if a different author was set in the revision log meta.

### Details

  • The functions now check for an author value in the revision log meta for each revision.
  • If present, the log displays the name and link for the meta author; otherwise, it falls back to the original revision's post_author.
  • This allows filters (such as on bbp_get_reply_raw_revision_log) to override the displayed author for moderation or other purposes.

### References

#3 @rollybueno
6 months ago

  • Keywords needs-testing added

@johnjamesjacoby commented on PR #34:


2 months ago
#4

This isn't quite right, as other bugs are in the way here.

  • link_text is not a valid argument in bbp_get_author_link() so it will always fallback
  • the $author_id should not be passed into post_id

Fixing this properly will likely require a new function that accepts an author ID instead of a post ID.

Note: See TracTickets for help on using tickets.