bbPress

Simple, Fast, Elegant

bbPress support forums » Plugins

bb_get_option_{option_name} noob questions

(7 posts)
  • Started 1 year ago by Null
  • Latest reply from Null
  • This topic is not a support question

No tags yet.

  1. Well this is a new option to use for us plugin creators. This way we can add/get stuff to the db right?

    Well since I am a noob, is there any documentation already with excamples how to use this? And in what table is is this all stored?

    Posted 1 year ago #
  2. While waiting for someone who knows, look at So10's Private Forum plugin because that call is used there as the plugin was developed for Trac Version of bbPress (now .74)

    Trent

    Posted 1 year ago #
  3. Here's some info: http://bbpress.org/blog/2007/01/bbpress-options-api/

    You shouldn't access the data from the tables directly. It's possible that at some point we'll change where the data is stored, so use the API :)

    Posted 1 year ago #
  4. Nice post! I wasn't sure how you called the API and Aditya was the only one I knew using those options thus far! Good to know for the future.

    Trent

    Posted 1 year ago #
  5. Hmm and where is the data stored at the moment (i see no options table)...

    Did some reading, very interesting! So if I re-write my bbPortal plugin, I can use the bb_get_option instead of those long sql queries for creating a new table etc. Just make sure that the name is unique, right? For now I just have to variables ($pforum_id and $number_of_topics) so I can use these with the bb_get and update functions.

    What about bb_get_option_{$option_name} and bb_get_option_from_db_{$option_name}? Isn't from_db always faster? (cause you skip all other checks), or isn't the speed of any influence? When would one use the first function and when the second?

    Posted 1 year ago #
  6. The speed difference is negligable.

    I would always use bb_get_option() so that a "power-user" can softcode the option value into the $bb variable if they want to avoid the extra database hits. bb_get_option_from_db() is mostly useful when you want to override data that has been softcoded (which probably isn't very often).

    PS: bb_get_option() is the function, 'bb_get_option_{blah}' is the filter.

    bb_get_option( 'my_option' ) grabs the value for my_option and filters it through anything you've defined in the 'bb_get_option_my_option' filter. The filter is probably pretty useless for data that plugins store since you probably won't have to modify on the fly the data that you provided in the first place.

    The filter may be useful for data the core bbPress provides (you might want to filter 'bb_get_option_page_topics', for example, so that whenever bbPress core calls bb_get_option( 'page_topics' ), you can modify the returned value on the fly).

    Posted 1 year ago #
  7. Aah ok thx for the info!

    Posted 1 year ago #

RSS feed for this topic

Reply

You must log in to post.

Code is Poetry.