Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hooks & Filters Docu


  • fel64
    Member

    @fel64

    Rather than just keeping private notes on the hooks and filters I found, I thought it best to maybe start a list here with everyone, just as a rough working documentation of the hooks and filters.

    For future ref/for people that don’t know, a hook is a means of bbPress making your plugin run every time a certain thing happens. To get that to work, put this code at the very bottom of your plugin:

    add_action( 'hook_name', 'functionname' );

    Filters are very similar to hooks, only it gives your plugin some data, you can then do something with the data (filter it), and then pass it back. To register for filters, put this code at the bottom of your application; remember to accept the parameters in your function and return them as appropriate.

    add_filter( 'filter_name', 'functionname' );

    Note that in both cases you want the name as a string and the function’s name as a string, no brackets or parameters at the end of it! An optional third parameter is the priority of your function; default is 10, so set this higher if you want it to execute last or lower if you want it to execute earlier.

    Some Filters

    topic_title – this passes the topic title to your function when the threads are being listed, like on the (default) front page.

    bb_allowed_tags – this is the array of HTML tags you can use in your posts. Hang a filter on this and add elements to the array if you want to allow more tags.

    Some Hooks

    bb_head – this is called when the HTML <head> element is being filled, so you can add stylesheets or javascript and the like.

    bb_user_logout obviously gets called when someone logs out.

    bb_init when someone logs in?

    bb_new_user when someone registers; passes the ID along I think

    bb_profile_menu – haven’t figured out how it works; I think it’s to do with the tabs at the top of the profile.

    If you know any more hooks or filters, or find ‘em, please post them here with a quick description if necessary!

Viewing 25 replies - 1 through 25 (of 37 total)

  • Null
    Member

    @null

    Nice we also need a list of available APIs :)


    Trent Adams
    Member

    @trent

    I would like that as well Null! I changed the title to be more clear! Hope you don’t mind!

    Trent


    fel64
    Member

    @fel64

    It’s not actually meant to be instructions, more like a list of hooks and filters Trent. I just included that as an aside for someone starting out.

    I’m sure you two have seen some more filters or hooks yourself, so help out and add them please. The point is, rather than waiting around for documentation, start getting some makeshift documentation up ourselves.

    post_text is a filter called on the text leaving the database I think, it’s what the emoticons use.


    Sam Bauers
    Participant

    @sambauers

    Although this topic is a noble idea, I can’t see it having enough structure to be really useful.

    I’ve started a conversation about creating a wiki for this sort of thing on the dev list. I think that would be optimal and more easily maintained.

    I’d be happy to start one, but I think it would be better coming directly out of Automattic.


    Trent Adams
    Member

    @trent

    Fair enough ;)

    Trent


    Trent Adams
    Member

    @trent

    @Sam – We talked about this documentation on the bbdevlist before and Matt wanted to lean towards the release of a major release of bbPress before any real start to avoid massive changes to the documentation, so here we sit *sigh*

    Trent


    Null
    Member

    @null

    Walks by and sees Trent sitting…. Heya Trent, want some company?


    fel64
    Member

    @fel64

    So you guys wanna keep sitting or anyone fancy not waiting around for however long?


    Null
    Member

    @null

    It’s out of our hands, come sit with us, silent demonstration :D


    fel64
    Member

    @fel64

    It’s not really out of our hands. We could do something.


    Sam Bauers
    Participant

    @sambauers

    Yes, we could set up a wiki – but to avoid (most of) the stated problem it would have to be a technical/developers wiki for now. We should also agree to move it’s contents to any official wiki when it comes along. I assume that an official wiki would use the same software as codex.wordpress.org which appears to be mediawiki, so to be compatible when the time comes we would have to use that too. My personal thought is that it is about time for this, and as the development community grows it is becoming necessary. I could set one up in half an hour (I’d be happy to host it – ad free). And we could work out the taxonomy of it here.

    To be slightly democratic, I say if ten people who we recognise as regulars/developers vote for it here, then we should go ahead. I’m also willing to hear arguments against the idea too.

    Should we vote on it?


    Null
    Member

    @null

    Set it up sam!

    For now we need some stuff about:

    Installation

    WP intergrating

    API’s

    Hooks

    Filters

    Plugins

    Templates/themes

    Did I forget something?


    fel64
    Member

    @fel64

    I don’t know if recognised or not, but I’m all for it.


    louisedade
    Member

    @louisedade

    I don’t know if I count as recognised or regular? Does it help if I remove my disguise?

    I’m all for some docs, even if it’s just a bare-bones list of available hooks and filters.


    Sam Bauers
    Participant

    @sambauers

    @Null: perhaps not installation and WP integrating as I don’t want to duplicate existing docs on this site and I think we should stick to developer docs for now – primarily to help plugin developers. The others seem like sound start to the categories though.


    Null
    Member

    @null

    Well lets start a wii thingy now with a list of:

    API’s

    Hooks

    Filters

    And with what they do/can be used for…?


    Sam Bauers
    Participant

    @sambauers

    Anyone got a good domain name suggestion? I’ve got a domain name registration credit at my host which I can use.


    fel64
    Member

    @fel64

    bbwiki.com is taken, but http://www.bbreference.com is not. If it’s understandable it doesn’t matter that much anyway. :)


    Null
    Member

    @null

    bbdocs.com?


    Trent Adams
    Member

    @trent

    I still think that codex.bbpress.org is still the best though to avoid confusion and keep the same design. Someone send something in the developer list again for some ‘more pointed’ discussion on this.

    Trent


    chrishajer
    Participant

    @chrishajer

    Ditto on the subdomain of bbpress.org.


    fel64
    Member

    @fel64

    Didn’t you say there will be no Automattic documentation before 1.0 release? Obviously codex.bbpress.org is the best, but that would be official … and we haven’t got official.


    Sam Bauers
    Participant

    @sambauers

    We should assume that codex.bbpress.org is out of the question for now, even though the content that we generate may end up there.

    How about bbpulp.org ?


    Null
    Member

    @null

    quote: How about bbpulp.org ?

    I love it :D


    Sam Bauers
    Participant

    @sambauers

    > I love it :D

    So do I, so here it is http://bbpulp.org

    Registration required to contribute.

    All articles to be submitted under the GPL Free Documentation License.

Viewing 25 replies - 1 through 25 (of 37 total)

You must be logged in to reply to this topic.