Search Results for 'code'
-
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!
Hi,
I have a form to update a plugin’s settings. The problem is, it seems to update on it’s own as well. Seems randomly and appears mostly when surfing through the admin pages. Whats wrong with my form and how to fix it?
The form:
// Update portal
function update_bbportal() {
global $bbdb;
$bbdb->query("UPDATE <code>$bbdb->portal</code> SET pforum_id = '". $_POST['forum_id'] ."', number_of_topics = '". $_POST['number_of_topics'] ."'");
}
// Show form
function bbportal_form() {
?>
<h2><?php _e('Portal Management'); ?></h2>
<h3><?php _e('Portal settings'); ?></h3>
<form action="" method="post">
<table>
<tr><th scope="row"><label for="forum_id"><?php _e('Where do you want to pull the topics from?'); ?></th>
<td><?php forum_dropdown(); ?></label></td>
</tr>
<tr><th scope="row"><?php _e('Number of topics on the portal:'); ?></th>
<td><input type="text" name="number_of_topics" id="number_of_topics" /></td>
</tr>
</table>
<p class="submit alignleft"><input type="submit" onclick="<?php update_bbportal(); ?>" value="Submit" /></p>
</form>
<?php
}I also no longer want to use the created and used database table “portal”, but use the “bb_update_option” and “bb_get_option”. How to do this?
Thx
Hi,
I have placed
<?php login_form(); ?>in the wordpress sidebar and it doesn’t appear however once I goto the forum pages it displays the login form or the welcome messages.I have the wordpress header file linked in the bbpress config.php file aswell.
Does anyone know what might be the problem?
Thanks,
Rich
:D:D:D:D
I could always import the content from WP to MT though, couldn’t I? LOL! I already had MT setup within 15 minutes on a sub domain name a few weeks back, shouldn’t take me too much longer to set it up this time.. whee!