Search Results for 'code'
-
Search Results
-
I have another post in the forum, but if you are interested in using a great software package that limits spam and server attacks before they access the site, then you might be interested in Bad Behavior. I really like it because it really decreases the load on the server as well.
While they do not have a plugin for bbPress and creating one isn’t in the cards right now, you can do it by downloading the newest Bad Behavior release and placing it as a folder in the root of your bbPress installation.
After that, you just need to call it. I did this by adding the following to config.php after the /* Stop editing */ part.
require_once( BBPATH . '/Bad-Behavior/bad-behavior-generic.php');
That is the easy way without a plugin. Just thought I would share it for those that are interested.
Trent
Topic: Plugin: Summon user
I just made another quick plugin. You can specify a user to be noticed by mail about the recent topic. Read more here:
http://bbpress.org/forums/topic/458
To install put the file into your
/my-plugins
folder and add<p>
<label for="summon_user_id"><?php _e('Summon:'); ?>
<?php summon_user_dropdown(); ?>
</label>
</p>
behind the last
endif;
to your/my-templates/post-form.php
Download here:
http://la-school.com/2006/downloads/summon_1_0.zip
merry christmas.
Topic: Form aint working, plz help
Well I’ve created this form but it aint updating the db. What am I doing wrong?
function update_portal($number_of_topics) {
global $bbdb, $bb_table_prefix;
$bbdb->query("UPDATE ".$bb_table_prefix."portal SET number_of_topics = '$number_of_topics'");
}
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
update_portal($_POST['number_of_topics']);
}
// Show form
function portal_form() {
?>
<h2><?php _e('Management'); ?></h2>
<form action="" method="post">
<?php do_action('update_portal',''); ?>
<h3><?php _e('Portal settings'); ?></h3>
<table>
<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" value="Submit" name="submit">
</form>
<?php
}
Thx
Topic: Plugin Private Posts/Blog
Basically I’m working on a plugin for bbpress that will skip wordpress all together ( no offense wordpress
)
Frankly I think wordpress is too advanced for the average “myspace” type user / target visitor. And, I want to have a community like system like myspace or livejournal.
So I want to basically add a blog section to bbpress where you can keep a private journal… with privacy options on each blog entry to either Private or Public, and if you select Public it will put it in a Forum as a new topic for people to discuss.
I was hoping to get a few pointers as to what functions to look at to help me achieve this through bbpress or if I should even continue doing this and try to customize wordpress-mu instead to fit the visitor
Heres what I have looked at so far:
1) Add new topic / Write blog
bb-templates/post-form.php
......
<label for=”forum_id”><?php _e(‘Pick a section:’); ?>
<?php forum_dropdown(); ?>
</label>
<!– DIRT_PRIVACY –>
Set the privacy:
<select name=”dirt_privacy” id=”dirt_privacy” tabindex=”6″>
<option value=”public” selected>Public</option>
<option value=”private”>Private</option>
</select>
<small>**Choose ‘Private’ if you want this to be a blog only readable by you</small>
<!– END DIRT_PRIVACY –>
<?php endif; ?>
<p class=”submit”>
<input type=”submit” id=”postformsub” name=”Submit” value=”<?php _e(‘Send Post’); ?> »” tabindex=”4″ />
bb-includes/functions.php -> bb_new_topic();
function bb_new_topic( $title, $forum, $tags = '' ) {
// function bb_new_topic( $title, $forum, $tags, $dirt_privacy = ” ) {
global $bbdb, $bb_cache, $bb_current_user;
$title = apply_filters(‘pre_topic_title’, $title, false);
$forum = (int) $forum;
$now = bb_current_time(‘mysql’);
if ( $forum && $title ) {
// if ($dirt_privacy==’public’){
// ADD AS NORMAL TOPIC HERE (depending on whether ‘adding new topic’ or ‘writting new blog’, determine whether to add as default normal Forum Topic (public) or include in users blog but also as public Blog Forum Topic
$bbdb->query(“INSERT INTO $bbdb->topics
(topic_title, topic_poster, topic_poster_name, topic_last_poster, topic_last_poster_name, topic_start_time, topic_time, forum_id)
VALUES
(‘$title’, $bb_current_user->ID, ‘{$bb_current_user->data->user_login}’, $bb_current_user->ID, ‘{$bb_current_user->data->user_login}’, ‘$now’, ‘$now’, $forum)”);
$topic_id = $bbdb->insert_id;
if ( !empty( $tags ) )
add_topic_tags( $topic_id, $tags );
$bbdb->query(“UPDATE $bbdb->forums SET topics = topics + 1 WHERE forum_id = $forum”);
$bb_cache->flush_many( ‘forum’, $forum_id );
do_action(‘bb_new_topic’, $topic_id);
return $topic_id;
//} elseif ($dirt_privacy == ‘private’) {
// ADD TO DB AS PRIVATE BLOG HERE
//}
} else {
return false;
}
}
Sorry if I’m a bit confusing as I am a bit confused right now
Again, any functions/documentation/help I should look at would be appreciated.
-BHensley.com
-Bakedlog.com