Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 29,576 through 29,600 (of 32,432 total)
  • Author
    Search Results
  • #56719

    In reply to: Plugin: Avatar Upload

    LMD
    Participant

    Well, yes, the plugin includes a file that must be placed into the bbPress root as well as another file that must be moved into the templates folder (either bb-templates/kakumei or my-templates/template-name). Not to mention the creation of the avatars folder and uploading of the default avatar.

    I can not see any way around this other than uploading all files to the my-plugins/avatar-upload folder and then using the script to move them to the right locations. Although, the file that remains in the my-plugins would still need to be manually edited to set the plugin’s options. Likewise, the folder creation could be done with a script rather than the current manual creation (as SamBauers suggested on the Plugin Browser thread).

    Is there a hook for when a plugin is activated? Looking around bbPulp I found the following…

    bb_deactivate_pluginXXX
    bb_activate_plugin_XXX

    … but no information on how they are used.

    #59352
    Null
    Member

    Hi,

    Wheren’t you the guy that fixed (or claimed to have fixed) this particulair error I had with the bbMenu plugin?

    Thinking… yeah you where it, you said you fixed it using $bbdb->get_results. So I replaced all mysql_query() with it, but this caused an error with the mysql_fetch_array. So what more did you change? Cause I can’t seem to fix it :( I can hardly program, so some help plz :)

    Thx

    #2149
    bobbyh
    Member

    A lot of bbPress forums have taken advantage of easy user integration with WordPress. The next step to integrating a WordPress blog and bbPress Forum is to create a bbPress Theme to match your WordPress Theme. bbPress doesn’t ship with built-in support for a sidebar, although I found it trivial to add this with a small plugin. What I really missed was a lightweight way to access WordPress’ wp_list_bookmarks Template Tag function, which lets you display your WordPress Blogroll links.

    To add this functionality, I wrote this bbPress List Bookmarks plugin. To install this plugin, download the zip and unzip it to your bbPress server under your /my-plugins folder. The zip should extract to a folder named “list_bookmarks”, so the location of these files should be /my-plugins/list_bookmarks. Then, in your bbPress theme, add a wp_list_bookmarks Template Tag with whatever parameters you want (just like you would when editing a WordPress Theme). You shouldn’t need to hack any of the plugin files to get this to work, although of course you’ll have to edit your bbPress Theme to take advantage of this plugin.

    This plugin should work whether or not these WordPress tables are located in the same database as your bbPress tables, as long as your WordPress tables are located in the same database as your integrated user tables.

    I’ve tested this plugin on my site, which currently uses bbPress v0.8.2.1 and WordPress v2.2.1. If you use WordPress 2.0 or earlier and you want to use this plugin, you should probably upgrade your WordPress first as wp_list_bookmarks is a new function introduced in WordPress v2.1. I don’t think it should matter what version of bbPress you use.

    This plugin ships with a database class called bbwpdb.php that lets us access the WordPress database tables. The bbwpdb.php file is basically a clone of the bbPress /bb-includes/db.php file, edited to let us retrieve WordPress tables. The remaining files are simply three WordPress PHP pages needed (wp-admin/admin-db.php, wp-includes/bookmark-templates.php, and wp-includes/bookmark.php), with slight edits to make it use the bbwpdb database class, instead of the WordPress or bbPress database class. The last file (list_bookmarks.php) just glues everything together.

    #59270
    Trent Adams
    Member

    I appreciate keeping this discussion civilized everyone! Good discussion on any topic without personal insults and over-reaction is great. ;)

    Trent

    #59350
    M
    Member

    Stick with the ezSQL format… it’ll be much easier.

    Something like this (using foreach instead of while):

    $query = "SELECT * FROM $bbdb->menu
    WHERE set = 'inactive' ORDER BY order ASC";
    $r = $bbdb->get_results( $query );

    foreach( $r as $rw ) {
    // now mess with $rw
    echo $rw->database_row . "<br>n";
    }

    Something that might be helpful would be to browse the source of the ezSQL class in /wp-includes/wp-db.php

    The latest from Justin Vincent, the author

    http://www.woyano.com/jv/ezsql

    The version used in bbPress and WordPress

    https://trac.wordpress.org/browser/trunk/wp-includes/wp-db.php

    It might help you… you’d be able to see where mysql_query is begin used, and how to use the ezSQL format best.

    I think the reason you’re running into problems with mysql_fetch_array is because it’s already used.

    Not sure on that one though… I would have to check.

    Also, what might cause an error: $bbdb->query will not return anything at all. $bbdb->get_results needs to be used for multi-dimensional array data, $bbdb->get_row or $bbdb->get_col need to be used for single array data, and $bbdb->get_var needs to be used for non-array/string data. $bbdb->query is used for inserting data, the others are used for retrieving it.

    Someone correct me if I’m wrong, but I’m pretty positive that’s how it goes.

    ezSQL is lovely. It certainly takes the pain out of MySQL data manipulation.

    So I guess that makes the answer to your question “Neither.” $bbdb->get_results should do the trick.

    And sorry for the screed. :D

    #59308
    _ck_
    Participant

    Views don’t have proper titles either apparently, here’s plugin to fix that.

    function bb_get_view_title($title) {
    if (is_view()) {$title = get_view_name(). ' &laquo; ' . bb_get_option( 'name' ); }
    return $title;
    }
    add_filter( 'bb_get_title', 'bb_get_view_title' );

    #2148
    Null
    Member

    Hi,

    I currently have an API problem fixing a plugin. Using mysql_query() will result in errors on some boards so I wanted to change this using $bbdb->get_results(). This works, but mysql_fetch_array will error things up now. What do I need to change to make this work correctly?

    Current code (without using $bbdb->get_results()):

    $r = mysql_query("SELECT * FROM $bbdb->menu
    WHERE set = 'inactive' ORDER BY order ASC");
    while($rw = mysql_fetch_array($r))

    #57313

    In reply to: Plugin: bb-Topic-Views

    _ck_
    Participant

    Here’s a plugin to extend the topic-views plugin and add a “most-views” view page (ie. view.php?view=most-views)

    It does it with a minimum number of mysql calls, just 10 to display an entire page on my setup. You have to hack your views.php template to add the views column, use $topic->views for the view count to use the cached data in memory instead of an extra mysql query for each topic.

    function most_views_views( $views ) {
    global $views;
    $views['most-views'] = 'Topics with the most views';
    return $views;
    }
    add_filter('bb_views', 'most_views_views');

    function most_views( $view ) {
    global $bbdb, $topics, $view_count;
    switch ( $view ) :
    case 'most-views' :
    $limit = bb_get_option('page_topics');
    $where = apply_filters('get_latest_topics_where','');
    $most_views = $bbdb->get_results("SELECT topic_id FROM $bbdb->topicmeta WHERE meta_key='views' ORDER BY cast(meta_value as UNSIGNED) DESC LIMIT $limit");
    foreach (array_keys($most_views) as $i) {$trans[$most_views[$i]->topic_id] =& $most_views[$i];} $ids = join(',', array_keys($trans));
    $topics ="SELECT * FROM $bbdb->topics WHERE topic_id IN ($ids) $where ORDER BY FIELD(topic_id, $ids)";
    $topics = $bbdb->get_results($topics);
    $view_count = count($topics);
    $topics = bb_append_meta( $topics, 'topic' );
    break;
    default :
    do_action( 'bb_custom_view', $view );
    endswitch;
    }
    add_action( 'bb_custom_view', 'most_views' );

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

Viewing 25 results - 29,576 through 29,600 (of 32,432 total)
Skip to toolbar