Search Results for 'code'
-
AuthorSearch Results
-
July 22, 2007 at 5:20 am #57452
In reply to: *seamless* wordpress integration
kenzor
MemberSo, if you now go through the template files for your bbPress installation, you will need to replace all instances of “
<?php bb_get_header(); ?>” with the WordPress command “<?php get_header(); ?>“. The same thing goes for the footers, so you change all instances of “<?php bb_get_footer(); ?>” to “<?php get_footer(); ?>“.I used a simpler method to achieve the same result. Rather than going through and changing every call to bb_get_header() and bb_get_footer() I simply created a custom header.php and footer.php file.
Then in the header I have only:
<?php get_header(); ?>In the footer I have only:
<?php get_footer(); ?>The benefit of this is you only need 2 custom files, you don’t need to search and replace all instances, and if you need to setup global vars for the more advanced WordPress integration techniques you only have to add them once into your custom header.php.
July 22, 2007 at 3:33 am #59300In reply to: front page takes 50 mysql queries
_ck_
ParticipantWell there’s no way around the fact that “use display names for admin” basically MUST fetch the display name from the wp_users table when asked for it – and if it’s not been accessed before it’s not cached so it must hit the mysql db directly.
However, since “use display names” forces the forums table to store the display name properly, there’s no need to run the last poster id through the routine again and force a fetch of the display name, it’s already in the username field for last poster.
The good news however is between that tweak, a couple other bits of fine tuning and the undocumented $bb->load_options = true; I was able to get the queries down to just 10 for the front page for visitors and 13 for logged in members. This includes an extensive number of plugins, including useronline trackline (not the simplified one here but a port from wordpress).
It’s never been faster and rather impressive
July 22, 2007 at 3:24 am #59266In reply to: let’s build a poll plugin!
_ck_
ParticipantI’ve never heard anyone on the various bbPress related channels talk about a need for poll features
Do you realise the irony in that if this thread had a poll, we could more easily evaluate how many people are interested in a poll feature. LOL. Also evaluate in other threads how much interest there is in wp+bb integration.
I simply want more people and therefore more talent in the fray that is bbpress. I’ve tried various clever google search patterns to try to determine the unique number of bbpress installs (that are publicly indexed) and I come up with around 200 installs. How many of these are active and have more than a few members is unknown of course. I’d like to see that number be 2000 by January and the only way for that to happen is to have certain common forum perks available. “Competitive frenzy” is one way to see it but inaccurate to my thoughts. I’d just call it feature motivation
July 22, 2007 at 1:26 am #59232In reply to: Plugin: Plugin browser for bbPress
Sam Bauers
ParticipantThere is a project with much broader scope to implement a full-blown plugin updater on WordPress which is part of the Google Summer of Code.
July 21, 2007 at 11:04 pm #59337In reply to: Adding a new User Type
fel64
MemberIt’s pretty simple, but you need a plugin to do it. Here’s how it probably goes.
<?php
/*
Plugin Name: Add lusers
Description: adds the luser role
Author: fel64
*/
add_filter('get_roles', 'addlusers');
function addlusers( $roles ) {
$roles['luser'] = $roles['member']; //duplicate member capabilities
$roles['luser'] =& $luser; //convenience
$luser['name'] = __('Luser');
$lusercaps = array('be_sucky', 'be_awesome', 'see_secrets');
foreach( $lusercaps AS $cap ) {
$luser['capabilities'][$cap] = true;
}
return $roles;
}
?>I hope that’s not too complex, I took some shortcuts. Basically all you have to do is put that in an empty text file, save as
lusers.php(or whatever), upload to your server and activate. You just need to customise a few lines: change all the instances of luser to whatever you want, and customise the extra capabilities you want them to have if any. These capabilities will be on top of the ones normal members have. (Poo, I just realised the $bb_roles->add_role() function makes it all much easier. Ah well, at least this way you can use thememberas your base.)Then go to the members’ profiles and make them all lusers. Or whatever.
July 21, 2007 at 8:33 pm #59182In reply to: plugin: Markdown
fel64
MemberHad a bit of a rewrite and now blockquotes are also possible, to infinite depth. Currently this is one blockquote:
> block
> quote
because I figured if you were writing something and you had two paragraphs that’d be more likely. But I would *love* advice on the syntax or feedback from you tisme. New source is http://www.loinhead.net/files/felise and to check out how it works you can still use http://www.loinhead.net/files/felise.php (same basic code, just modified without bb).
July 21, 2007 at 5:58 pm #59231In reply to: Plugin: Plugin browser for bbPress
jolaedana
MemberGreat stuff.
I think this is something it would be cool if WordPress should attempt- though it’d require one heck of an organizational system.
fel64
MemberCertainly there’s no code that does that in bbSync, nor in bbPress I think. Bizarre.
post_title? Have you maybe got a plugin that adds titles to posts?If only errors included where in the PHP code it was
July 21, 2007 at 2:33 pm #59336In reply to: performance idea, preloading general options
_ck_
Participanter, omg, tracing the code I think the option has already been written into bbpress and just not documented?
$bb->load_options = true
put into config.php ?
can it be that easy? does it work or not ready for primetime?
July 21, 2007 at 2:26 pm #2146Topic: performance idea, preloading general options
in forum Troubleshooting_ck_
ParticipantI’ll probably copy this to TRAC but it’s good for a discussion here too?
I’ve been poking around the results using the query list plugin and something hit me.
Options are not being preloaded (ie. SELECT meta_value FROM $bbdb->topicmeta WHERE topic_id = 0)
However a few options, like active plugins MUST be loaded on every load. So the options table has to be queried at least once, usually two or three times. This causes extra queries.
So the question is, what’s slower, unserializing possibly serialized data in half a dozen to a dozen options, or making half a dozen to a dozen extra mysql queries?
Preloading could be a plugin, the cache code is already there. Just wondering if I should bother working on it given the above question.
fel64
MemberYup. Add
global $bb_cache;to bbpress’ config.php.July 21, 2007 at 4:13 am #59297In reply to: front page takes 50 mysql queries
_ck_
ParticipantActually he can’t really “fix” the plugin, it’s an overall integration failure which necessarily adds more mysql queries (just like the plugin needed to allow spaces adds more overhead).
Basically the output template will HAVE to use a difference function call than the “use display name” which fixes it everywhere else before it’s written back to the database.
It’s the cost of integration and yet another example of why bbpress isn’t magically better than any other forum for integration with wordpress.
(or just use my workaround to cut out the extra queries

ps. “mdawaffle” wasn’t a “dig” – isn’t that his nickname?
July 20, 2007 at 11:11 pm #2143sam_a
MemberI know the emails have to come from somewhere, but still… this was surprise.
Could there be a notice somewhere that the admin email is used to send every registration notification? Spambots are getting it too

I had expected that bbPress would use it only to send notifications to the admin.
July 20, 2007 at 6:12 pm #59310In reply to: Noobish CSS Question
Andrew
MemberThanks. Someone else contacted me with another fix.
add this
<div style=”clear:both;”></div>
just before the end of wrapper div.. before this
</div>
<div
id=”footer”>
<p>Nyquist Forums is proudly powered by <a
href=”http://bbpress.org”>bbPress.</p
>
</div>
There are more topics but they are private.
July 20, 2007 at 5:16 pm #2140Topic: ‘Are you sure you want to submit this post?’
in forum Troubleshootingtisme
Memberwhat are possible reasons/conditions of getting this nonce message?
I gathered it could be issued by the
bb_check_admin_referer( 'create-post_' . $topic_id );but what is it for?PS I saw there’s a similar title resolved thread, but it doesn’t make it clear.
July 20, 2007 at 5:06 pm #59291In reply to: front page takes 50 mysql queries
_ck_
ParticipantNo, all those are properly cached and do not reduce mysql queries.
topic_last_poster() for some reason forces a new metadata reload and two new mysql queries, uncached. It’s meant to be able to be used outside loops so it basically has to. It can’t just peek at the entire topics table just returned from the database.
Any plugin that affects the username has already affected it on the write to the topics table. It’s already set for presentation. No need to hook it unless you are doing something really crazy. Even the “admin use display names” plugin will still work correctly.
It’s the only really easy optimization.
“topic_last_poster()” sticks out badly if you install the plugin I posted above and look at the results.
update: if you are really worried about filters you can either have a lightweight pseudo function or do it this way
echo apply_filters( 'topic_last_poster', $topic->topic_last_poster_name, $topic->topic_last_poster);instead of just
echo $topic->topic_last_poster_name;and that will apply any filters looking for it
July 20, 2007 at 3:53 pm #59289In reply to: front page takes 50 mysql queries
_ck_
ParticipantOMG. This is insane.
Go edit your front-page.php, forum.php and view.php templates.
Change
topic_last_poster();to
echo $topic->topic_last_poster_name;Cuts mysql queries in half. I went from 50 to under 20.
The data is already in the retrieved topics in memory, there’s no need to reload all the userdata.
July 20, 2007 at 3:21 pm #59309In reply to: Noobish CSS Question
fel64
MemberThere’s no direct solution. You can do one of these:
- Change
<?php tag_heat_map(); ?>to<?php tag_heat_map('limit=30'); ?>. The default limit is 40 I think, if you set it to 30 or any appropriate number they won’t go so far down. But you’d want to change that again later. - Put the
footerinside thewrapper. I’m not sure how your templates are arranged, but in kakumei you’d just have to openfooter.phpand move the codeblock that produces the divfooterup a few lines, just above the previous</div>. Permanent change, now the footer is on the white, but the white will always stretch down sufficiently. - Wait it out – eventually there’ll be enough topics to stretch the page

I think there are a few other things you could do, but that second point is probably the best if you need it changed now.
July 20, 2007 at 2:15 pm #59228In reply to: Plugin: Plugin browser for bbPress
so1o
Participanti dont see any plugins in the list either.. i dont have any other plugin except this one..
am i doing something wrong!
July 20, 2007 at 2:12 pm #59260In reply to: let’s build a poll plugin!
_ck_
ParticipantYou mean the one by GamerZ S010?
I’ve watched him improve that over the past year or two, actually sent some bug fixes and improvements. Still doesn’t do quite everything I’ve seen in other advanced polls but he’s got the multi-vote option so that’s good.
It uses the metadata so it would be fairly easy to convert, the only problem is his creation and management menus are all meant for the admin interface so a new creation routing would have to be written for the regular user interface. Then there is the problem of the trigger and attachment. I guess it gets attached to the topic-info box.
Now if we could only get him to switch from simple machines forum to bbpress we’d have a shedload of new bbpress plugins within a month
July 20, 2007 at 1:53 pm #59302In reply to: Custom fields
so1o
Participantand you can catch this field in
bb_post.phpaction to process the post.July 20, 2007 at 1:14 pm #56714In reply to: Plugin: Avatar Upload
Detective
MemberIt appears just in the upload avatar template. Everything else works fine
July 20, 2007 at 1:06 pm #59212In reply to: Help with an if/then statement
outchy
MemberYES!!! oh, you’ve made my week, thank you so much

the log in text is here in template-functions.php:
if ( ( is_topic() && bb_current_user_can( ‘write_post’, $topic->topic_id ) && $page == $last_page ) || ( !is_topic() && bb_current_user_can( ‘write_topic’, $forum->forum_id ) ) ) {
echo “<form class=’postform’ name=’postform’ id=’postform’ method=’post’ action='” . bb_get_option(‘uri’) . “bb-post.php’>n”;
bb_load_template( ‘post-form.php’, array(‘h2’ => $h2) );
bb_nonce_field( is_topic() ? ‘create-post_’ . $topic->topic_id : ‘create-topic’ );
if ( is_forum() )
echo “<input type=’hidden’ name=’forum_id’ value=’$forum->forum_id’ />n”;
else if ( is_topic() )
echo “<input type=’hidden’ name=’topic_id’ value=’$topic->topic_id’ />n”;
do_action(‘post_form’);
echo “n</form>”;
} elseif ( !bb_is_user_logged_in() ) {
echo ‘<p>’;
printf(__(‘You must log in to post.’), attribute_escape( bb_get_option(‘uri’) . ‘bb-login.php’ ));
echo ‘</p>’;
}
do_action(‘post_post_form’);
}
this is the last piece of the puzzle for me
July 20, 2007 at 1:05 pm #59301In reply to: Custom fields
fel64
MemberYou can use a hook to add an input field. Your code would look something like this:
add_action('post_form', 'addmyinputfield');
function addmyinputfield() {
echo '<input type="text" name="mine" id="mine" />';
}You would need another hook to then get the value when it’s been posted. I’m not sure about this one, but I think the hook would be
pre_post. Again you use it in the same way as above:add_action('hook_name', 'function_name');There’s a list of hooks here, http://bbpulp.org/wiki/API/actions if that wasn’t the one you wanted. Maybepost_form_pre_post?July 20, 2007 at 12:54 pm #59211In reply to: Help with an if/then statement
fel64
MemberIt’s in front-page.php at the very bottom. You can see at the start it checks if $forums is set, and if it isn’t (line 75, where it says
else : $forums) it delivers the page to make a new topic (and in the background $forums isn’t set if the url has ?new=1). That’s where the post_form() is too. Finding that one out took a while
I don’t know. Where is the you must log in to post text?
- Change
-
AuthorSearch Results