Skip to:
Content

bbPress.org

Opened 4 years ago

Last modified 4 years ago

#3125 new enhancement

bbp_get_topic_id might incorrectly give back a reply_id or forum_id — at Initial Version

Reported by: casiepa Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version:
Component: General Keywords: needs-patch needs-unit-tests
Cc: contato@…

Description

Calling the bbp_get_topic_id($id) function will check if $id is a valid number by using ( ! empty( $topic_id ) && is_numeric( $topic_id ) ).
If function bbp_get_topic_id is called with a forum_id or a reply_id, it will still accept the value.

This behaviour should be changed, but there might be 2 ways:
1) if $id is a topic, return $id, otherwise 0 (so add the logic of bbp_is_topic to make sure $id is indeed a topic)
or
2) if $id is an ID for a reply, return the corresponding ID for the topic this reply is part of (ID crawling)

Regardless of chosing 1) or 2) apply the same logic to bbp_get_forum_id and bbp_get_reply_id.

Change History (0)

Note: See TracTickets for help on using tickets.