Skip to:

Opened 10 years ago

Last modified 9 years ago

#2684 new defect (bug)

Depreciate function bbp_update_topic_topic_id()

Reported by: netweb's profile netweb Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Component - Topics Keywords:


Following on from a previos IRC chat on bbPress meta where we have posts saving their own post ID as meta.

Depreciate bbp_update_topic_topic_id() introduced in r2955

Called only by bbp_move_reply_handler(), bbp_update_topic() and bbp_split_topic_handler()

bbPress does not make any queries to get a topics _bbp_topic_id from postmeta

We should use bbp_update_topic() instead to update a topic

Change History (4)

This ticket was mentioned in IRC in #bbpress-dev by netweb. View the logs.

10 years ago

#2 @netweb
10 years ago

  • Milestone changed from Awaiting Review to Future Release

#3 @netweb
9 years ago

Adding original discussion via IRC here:

jjj: I'm confused at that ticket. It looks like we're saving its post ID as a piece of meta?
jjj: s/we're/you want to/
jjj: s/saving/save/
netweb Yes, like we save the a topics post ID as _bbp_topic_id and the same for forums
jjj: But we never save it's own ID to itself, do we?
netweb: Yes we do for both topics and forums
jjj: What the heck for... Looking.
netweb: The other side/reverse of that ticket would be to NOT save _bbp_topic_id and _bbp_forum_id when it is the same as post id
jjj: I wonder if it was for doing a straight meta query to get ID's.
jjj: Which I don't think we do anymore.
netweb: bbp_update_topic_topic_id() is where it's down for topics
netweb: s/done
jjj: Yep. Looking at all that business now, and for '_bbp_topic_id' queries.
jjj: bbp_update_topic_topic_id() is the silliest function ever.
jjj: I think it was intended to allow for querieng only the meta table quickly, without JOIN'ing the posts table.
netweb: Yeah, also bbp_update_topic_id() is the only other place outside import and repair tools I see _bbp_topic_id
jjj: It's the only logical purpose it could serve, though querying the posts table by post_type would still be quicker.
netweb: I'm not sure if children/ancestors functions are walking up then stopping if id=self
jjj: I bet it's from the old days when single topic queries needed a way to also include the main topic post in the along with the reply posts.
jjj: Sniff around bbp_show_lead_topic() usages and see if there are any old _bbp_topic_id queries happening.
netweb: It could be legacy stuff, I'll have a sniff around bbp_show_lead_topic()

#4 @netweb
9 years ago

Also noting that bbp_insert_topic() adds _bbp_topic_id meta of itself when inserting topics:

(I've been deliberately ignoring this meta in unit tests thus far, not checking for it nor checking to ensure it doesn't exist)

Note: See TracTickets for help on using tickets.