Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 29,651 through 29,675 (of 32,499 total)
  • Author
    Search Results
  • #57452
    kenzor
    Member

    So, 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.

    #59300
    _ck_
    Participant

    Well 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 :-)

    #59266
    _ck_
    Participant

    I’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 ;-)

    #59232
    Sam Bauers
    Participant

    There 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.

    #59337

    In reply to: Adding a new User Type

    fel64
    Member

    It’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 the member as your base.)

    Then go to the members’ profiles and make them all lusers. Or whatever.

    #59182

    In reply to: plugin: Markdown

    fel64
    Member

    Had 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).

    #59231
    jolaedana
    Member

    Great stuff. :) I think this is something it would be cool if WordPress should attempt- though it’d require one heck of an organizational system.

    #58095

    In reply to: bbSync

    fel64
    Member

    Certainly 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 :P

    #59336
    _ck_
    Participant

    er, 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?

    #2146
    _ck_
    Participant

    I’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.

    #58093

    In reply to: bbSync

    fel64
    Member

    Yup. Add global $bb_cache; to bbpress’ config.php.

    #59297
    _ck_
    Participant

    Actually 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?

    sam_a
    Member

    I 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.

    #59310

    In reply to: Noobish CSS Question

    Andrew
    Member

    Thanks. 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.

    tisme
    Member

    what 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.

    #59291
    _ck_
    Participant

    No, 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

    #59289
    _ck_
    Participant

    OMG. 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.

    #59309

    In reply to: Noobish CSS Question

    fel64
    Member

    There’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 footer inside the wrapper. I’m not sure how your templates are arranged, but in kakumei you’d just have to open footer.php and move the codeblock that produces the div footer up 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.

    #59228
    so1o
    Participant

    i dont see any plugins in the list either.. i dont have any other plugin except this one..

    am i doing something wrong! :)

    #59260
    _ck_
    Participant

    You 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 ;-)

    #59302

    In reply to: Custom fields

    so1o
    Participant

    and you can catch this field in bb_post.php action to process the post.

    #56714

    In reply to: Plugin: Avatar Upload

    Detective
    Member

    It appears just in the upload avatar template. Everything else works fine :)

    #59212
    outchy
    Member

    YES!!! 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 :D

    #59301

    In reply to: Custom fields

    fel64
    Member

    You 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. Maybe post_form_pre_post?

    #59211
    fel64
    Member

    It’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 :P

    I don’t know. Where is the you must log in to post text?

Viewing 25 results - 29,651 through 29,675 (of 32,499 total)
Skip to toolbar