#2806 closed defect (bug) (fixed)
bbp_get_topic_last_reply_id() returns the topic id when the topic does not have any replies
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 2.6 | Priority: | high |
| Severity: | normal | Version: | |
| Component: | Component - Topics | Keywords: | 2nd-opinion has-patch |
| Cc: |
Description
// Create a forum $forum_id = bbp_insert_forum( array( 'post_title' => 'forum_title', 'post_content' => 'forum_content' ) ); // Create a topic $topic_id = bbp_insert_topic( array( 'post_title' => 'topic_title', 'post_content' => 'topic_content' ) ); var_dump( $forum_id ); var_dump( bbp_get_forum_last_topic_id( $forum_id ) ); var_dump( $topic_id ); var_dump( bbp_get_topic_last_reply_id( $topic_id ) );
Returns: int(59) int(0) int(60) int(60)
Expected: int(59) int(0) int(60) int(0)
Both functions create their correct meta values _bbp_last_topic_id and _bbp_last_reply_id with value 0
https://bbpress.trac.wordpress.org/browser/trunk/src/includes/forums/template.php?annotate=blame#L891
https://bbpress.trac.wordpress.org/browser/trunk/src/includes/topics/template.php?annotate=blame#L2018
Attachments (1)
Change History (6)
Note: See
TracTickets for help on using
tickets.
Patch includes a fix and unit test documenting the issue.
Note: Need to consider a better file name, file location and function name for the included unit tests ;)