Search Results for '+.+default+.+'
-
Search Results
-
Topic: Hooks & Filters Docu
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 thinkbb_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!
Topic: Syntax questions
A couple of questions about what syntax to use, especially on template pages:
1. I see that a lot of people use
_e('string...')instead ofecho('string...'). Is this just a bbpress/wordpress thing or is this generally acceptable php coding?2. In front-page.php of kakumei (and many other places), I see people using this shorthand echo where normal text would work just fine. For instance, in the hottags div, it is:
<h2><?php _e('Hot Tags'): ?></h2>Why would you have PHP echo that when you could just have it as plain ol’ text in the first place? Am I missing something?
I realize neither of these is of any earth-shaking importance, but I would like to know so I can keep my code modifications in line with the default syntax that is used throughout. Thanks!
Topic: localhost installs
I recently did my first bbpress install on localhost and it went miserably. I used the latest download from today.
Checking on this forum I had the same path seperator issues and stylesheet issues others had, etc.
My $bb->domain and $bb->path were fine. The fresh install just didn’t work properly under xampp and then again a retry on easyPHP.
This is the solution and findings I found:
1. The first issue is because in config.php and bb-load.php dirname(__FILE__) is used to get the base path for BBPATH. This is not a good thing on localhost Windows based installs.
2. There are a number of attempted workarounds to this that I’ve read about in this forum. All of them that I saw didn’t work. Focusing on the issue with the stylesheet href not being correct I noticed that there was logic in the bb_get_active_theme_folder() function.
By default, the installer does NOT create an option entry ‘bb_active_theme’ in the database table topicmeta. The code logic doesn’t make the correct uri.
To fix this, do an install and then add a database field bb_active_theme in the topicmeta table.
For example, I set mine to:
Playing regular expression games to change x: and in general is not worth it. This seemed to be simple and worked right out of the box.
