Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 29,626 through 29,650 (of 32,491 total)
  • Author
    Search Results
  • #56727

    In reply to: Plugin: Avatar Upload

    LMD
    Participant

    Ok, version 0.7 is released: including the changes by SamBauers as well as an image sharpening (unsharp mask) function.

    @Sam – Using the latest version of your plugin, I tried installing the new version of Avatar Uplaod, but it still wouldn’t read the additional-files directory. This is what it looks like over FTP: screenshot (NOTE: if there is a problem viewing it — error 403 — try cutting and pasting the URL instead – it’s probably my over-zealous image-hotlinking prevention).

    #56726

    In reply to: Plugin: Avatar Upload

    _ck_
    Participant

    @box87, be aware that single upload class is larger than most of the the entire bbpress core code itself – massive overkill unless you really, really really need it’s extra features?

    @louisedade – I found a major caching bug where you are not taking advantage of user meta data that has already been loaded previously in the same execution – this causes 10-30 extra mysql queries for every topic that is displayed depending on how many posts are displayed at once.

    Here’s a hacked workaround, though I am not sure it’s a good idea to tap into the user_cache directly. I’d otherwise suggest nicely using bb_get_user() as it checks the cache first but the problem with that is it fetches ALL the data if not in the cache which is overkill. Too bad there isn’t a bb_get_user_meta($id,’metaname’) but oh well – for now replace this top section of code:

    function avatarupload_get_avatar($id, $fulluri=1, $force_db=0)
    {
    global $bbdb, $user, $bb_user_cache;

    if ($force_db == 0 && ($id == $user->ID || !empty($bb_user_cache[$id])) )
    {
    if (!empty($user->avatar_file)) {
    $a = explode("|", $user->avatar_file);
    } else {
    if (!empty($bb_user_cache[$id]->avatar_file)) {
    $a = explode("|", $bb_user_cache[$id]->avatar_file);
    }
    else {return false;}
    }
    }
    else

    Drops my topic queries by 20 per page while still functioning correctly in all other cases.

    Discovered this problem via bb-benchmark

    #59311

    In reply to: Noobish CSS Question

    M
    Member

    In Safari/Camino, it still has issues. #hottags{height: 100%;} helps that one.

    Quick fix, not guaranteed to work… thus, I resort to an acronym: YMMV.

    #59354
    Null
    Member

    Okay okay, 1 day :) (just kidding)

    #52445

    In reply to: blockquote?

    fel64
    Member

    verbatim in my bb-admin/style.css file does no good

    because there are no blockquotes in bb-Admin. Apply them to your theme, which should be in my-templates/themename/style.css. I agree, kakumei needs default blockquote support. I’ll add a trac ticket or sumthin’.

    #58683
    M
    Member

    Funny you mention this… I’m doing some work for a client at the moment using WordPress and I wanted to change some of the admin backend text without modifying core files. Localization using an en.mo file turned out to be the way to go.

    I believe bbPress supports localization as well. It’s probably going to be the route you’ll want to take. (edit: it does, BBLANG in config.php, drop the .mo file in /bb-includes/languages/ I would assume)

    The file you’ll need to edit is a compiled binary, so you’ll have to get the bbpress.pot file, probably from the bbPress site somewhere. (edit: http://svn.automattic.com/bbpress-i18n/pot/tags/)

    Once you’ve got the file, check out poEdit (http://sourceforge.net/projects/poedit/). It’s an open-source cross-platform mo/po/pot editor. Create a New catalog from .pot file, make sure the option to compile to .mo is checked in the preferences, and you should be good to go.

    The top-left box contains the text to be translated, the bottom-left contains the “translation.” Ctrl-F, find the string, and you’re good from there.

    Note: I haven’t tried this with bbPress but it works great with WordPress. Hope it helps.

    #56724

    In reply to: Plugin: Avatar Upload

    LMD
    Participant

    Thanks Sam! That’s awsome. I’ve downloaded and reviewed the code and I’ve made a couple of small modifications – added an option to the admin page and a tiny bit of validating (so that you can’t have a non-numerical or zero max_width etc — actually setting the sizes to zero will now reset the options to their “factory defaults”).

    @Plugin Users: I’m adding an unsharp mask routine to the reszing code before I commit the updates, so it might not be ready until tomorrow. If you’ve downloaded Sam’s update, you will have to do another update later.

    #52444

    In reply to: blockquote?

    I just installed bbpress yetserday on a new domain and have integrated it with wordpress using the plugin, etc. I also have found that the default template has no blockquote support. Even by including the blockquote definition given above by Trent verbatim in my bb-admin/style.css file does no good, here is a view source excerpt of the source file:

    <blockquote><p>[Shakir 5:57] O you who believe! do not take for guardians those who take your religion for a mockery and a joke...</p></blockquote>

    as a test…

    testing blockquote here in bbpress support

    nope. above line doesnt render in blockquoted indent either.

    i think the problem is the insertion of <p></p> tags around every paragraph. Since blockquote is an inline style, the p tags override it. we could get around this by using a div class=blockquote kind of construction instead but wouldt it be nicer if blockquote just worked out of the box?

    #58682
    outchy
    Member

    where can i change this default text for these links at the bottom of topic.php:

    <?php topic_delete_link(); ?> <?php topic_close_link(); ?> <?php topic_sticky_link(); ?>

    i can’t find it except in template-functions.php, which i won’t ever touch again :)

    #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

Viewing 25 results - 29,626 through 29,650 (of 32,491 total)
Skip to toolbar