Info
- 38 posts
- 9 voices
- Started 4 years ago by fel64
- Latest reply from Olaf
- This topic is not resolved
Hooks & Filters Docu
-
- Posted 4 years ago #
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_logoutobviously gets called when someone logs out.
bb_initwhen someone logs in?
bb_new_userwhen 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!
-
- Posted 4 years ago #
Nice we also need a list of available APIs :)
-
- Posted 4 years ago #
I would like that as well Null! I changed the title to be more clear! Hope you don't mind!
Trent
-
- Posted 4 years ago #
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_textis a filter called on the text leaving the database I think, it's what the emoticons use. -
- Posted 4 years ago #
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.
-
- Posted 4 years ago #
Fair enough ;)
Trent
-
- Posted 4 years ago #
@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
-
- Posted 4 years ago #
Walks by and sees Trent sitting.... Heya Trent, want some company?
-
- Posted 4 years ago #
So you guys wanna keep sitting or anyone fancy not waiting around for however long?
-
- Posted 4 years ago #
It's out of our hands, come sit with us, silent demonstration :D
-
- Posted 4 years ago #
It's not really out of our hands. We could do something.
-
- Posted 4 years ago #
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?
-
- Posted 4 years ago #
Set it up sam!
For now we need some stuff about:
Installation
WP intergrating
API's
Hooks
Filters
Plugins
Templates/themesDid I forget something?
-
- Posted 4 years ago #
I don't know if recognised or not, but I'm all for it.
-
- Posted 4 years ago #
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.
-
- Posted 4 years ago #
@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.
-
- Posted 4 years ago #
Well lets start a wii thingy now with a list of:
API's
Hooks
FiltersAnd with what they do/can be used for...?
-
- Posted 4 years ago #
Anyone got a good domain name suggestion? I've got a domain name registration credit at my host which I can use.
-
- Posted 4 years ago #
bbwiki.com is taken, but http://www.bbreference.com is not. If it's understandable it doesn't matter that much anyway. :)
-
- Posted 4 years ago #
bbdocs.com?
-
- Posted 4 years ago #
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
-
- Posted 4 years ago #
Ditto on the subdomain of bbpress.org.
-
- Posted 4 years ago #
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.
-
- Posted 4 years ago #
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 ?
-
- Posted 4 years ago #
quote: How about bbpulp.org ?
I love it :D
-
- Posted 4 years ago #
> 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.
-
- Posted 4 years ago #
hey cool.
i was just looking for something like this and you just created it minutes ago!
i guess i'm too early.. not much there yet obviously.in the meantime, anyone out there know the filter/action that would allow me to disable the bbpress registration page entirely ( ie: registration.php ) ?
i'd love to do this via a plugin rather that hack the core bbpress files or delete/move the file altogether.
it would be like a "registration is temporarily disabled" plugin.
optionally, to be able to change the appearance/text on the registration page would be my next challenge. but one thing at a time.by the way, good work everyone!
-
- Posted 4 years ago #
The LDAP plugin has a feature that disables the registration page, you can make a simple plugin based on that.
ALternatively you could run the restrict registration plugin and blacklist everything.
-
- Posted 4 years ago #
right, i started by downloading the restrict registration plugin and trying to figure it out from there..
i'll take a look at the LDAP one too. thanks!
also, it occured to me that there might be an option in the config.php for this but i double checked and there wasn't. oh, well..i'll see if i can figure it out.
-
- Posted 4 years ago #
I think you started with looking at the wrong plugin.
I've got the code here if you want it, if you want a challenge, then *don't* read on...:
<?php /* Plugin Name: Disable registration Plugin URI: Description: Disables registration Author: Sam Bauers Version: 0.0.1 Author URI: */ add_action('bb_init', 'disable_registration'); function disable_registration() { global $bb; if ($_SERVER['PHP_SELF'] == $bb->path . 'register.php') { bb_die(__('Registration is temporarily disabled for this forum.')); } } ?>Make a new file from this code and drop it into your plugins folder. You may need to add some values in the header part to allow it to be registered in the admin area.