Skip to:

[Resolved] Accessing Topic Meta

  • Hi Guys,

    I am trying to extend the BP-Like plugin so that I can use it for a client project but also to give back to the community.

    Originally, the project was using site wide forums, which meant that topics and replies were being saved by bbpress into wp_post. Therefore I was able to extend the plugin to save the extra meta data into the wp_post_meta using get_post_meta() function.

    The problem came when the project moved to using buddypress groups forum. As group forum saves topics and meta into different tables, I have change from using get_post_meta() to bp_get_topicmeta(). Currently this is not actually sending anything back.

    So the question is : am I using the right function to call back topic meta? If not, which function should I be using and if there are any example code I can read though?

Viewing 8 replies - 1 through 8 (of 8 total)
  • bp_get_topicmeta() doesn’t exist in BuddyPress, or bbPress 1 (aka group forums) so… no :)

    Did you mean bb_get_topicmeta() ?

    Sorry, yes I meant bb_get_topicmeta()

    Where are you trying to use it? Have you hooked into an action?

    What data are you trying to get from it?

    i have an instance of wordpress which has buddypress plugin. The groups forum is set up. I have the like plugin inside wp-content/plugins/ and i am using the bb_get_topicmeta from within a php file within the like plugin.

    How am i meant to be hooked into the action?

    im trying to check if there a particular meta_key is set in the topic meta table and then the code adds the topic meta key/value .

    @paul_gibbs, I have tried to create an action in bp-custom.php and then hook into it in the theme. The problem seems to be that from


    you cannot access any functions which are defined within


    At the front end, the error you get is:

    ‘Fatal error: Call to undefined function any_function_starting_with_bb() in …/some_location/plugins/bp-custom.php on line 102’

    I’d be interested in the answer to this as well :)

    The trick to load bbPress 1.x (aka group forums) is this: `do_action( ‘bbpress_init’ );`

    As it will load bbPress, you should only do that when you know you need bbPress. It increases memory use and database requests for that particular page load, though this will be mitigated to an extent with persistent object caching.

    So the solution for anyone who is reading is that as Paul said, to use do_action (‘bbpress_init’) within the function that has the bb_ function you are trying to call!! It does not work setting it to the whole file. ( I tried it). It only has to be called once per function.

    Also an example of it is :

    Hope this helps someone else!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Accessing Topic Meta’ is closed to new replies.
Skip to toolbar