Forums

Join
bbPress Support ForumsPluginssorting posts by topic_title

Info

sorting posts by topic_title

  1. Hello,I'm a wordpress user and I just downloaded bbpress for a project I'm working on since I can't get some key features on wordpress. My project involves polls that can be created by users of the site, and also regular forum topics.

    I have gotten the polls plugin bbpress polls and it adds '[poll]' in front of the topic title. now I want to use this feature to display topics with polls separately from topics that don't have polls since this seems to be the most distinguishing factor.

    My question is how can I get the topic title in the loop for use in my code? the Function topic_title() displays the topic i.e. it echoes it, but I would like to get it as a string that I can use in functions.

    Also, I would like to know how I can get a reference of all the index keys in the $topics array so I can use them in my code.

  2. Hi,
    $query="SELECT topic_id FROM bb_topics";will return the array of the topic ids.
    Regards

  3. Use get_topic_title() to retrieve the topic title as a string while in the loop.

    To get the actual index keys of the $topics array, you can use array_keys, or if you want to actual topic IDs, you'd need to use $topic->topic_id inside a foreach loop assigning $topic.

  4. thanks. I'm guessing the get_ works for other properties too?

  5. Pretty much. The non get_ version is just an echo of the get_ one anyway :)

    http://trac.bbpress.org/browser/trunk/bb-includes/functions.bb-template.php

  6. You must log in to post.