Skip to:
Content
Pages
Categories
Search
Top
Bottom

Get replies ID of a given topic


  • Loc Pham
    Participant

    @phamdacloc

    Hello,

    Is there a function that allows me to grab the list of reply IDs to a given topic? I see there is a function that count the total number of replies for a given topic, but I can’t find one that will list the IDs out. bbp_get_topic_reply_count($topicId)

    How does bbPress currently render the replies for a given topic? Does bbPress fetch ALL the replies from the DB then against match its topicID? This sounds like a very DB intensive method so I assume there must be some other way that would allow us to know all the replies for a given topic.

    Thanks
    Loc

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    Talking purely on the DataBase side: Every reply has a metatag with the id of the ‘parent’, so the id of the topic. If you know the topic id (let say it’s 123) then a query to the DB on the postmeta table where (meta_key = ‘_bbp_topic_id’) and (meta_value=123) should give you the all the replies (including the topic itself)

    Talking functions, check out bbp_get_all_child_ids to get an array with the child records.

    Pascal.


    Loc Pham
    Participant

    @phamdacloc

    This is superb. Thanks Pascal.


    Robkk
    Moderator

    @robkk

    @casiepa

    Good find!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar