Skip to:
Content
Pages
Categories
Search
Top
Bottom

bb_get_option_{option_name} noob questions

  • 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?

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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

    Here’s some info: https://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 :)

    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

    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?

    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).

    Aah ok thx for the info!

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