Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 27,826 through 27,850 (of 32,495 total)
  • Author
    Search Results
  • #62515
    _ck_
    Participant

    I agree with not doing the actions in the templates – that was a mistake WordPress did for awhile eh? The hooks can go inside function edit_form in the core, no?

    Just for clarification, because this one is important, do_action('post_edit_form') should go AFTER the </form> is closed.

    do_action('pre_edit_form') should be before the <form

    and do_action('edit_form') should be inside the form.

    If all the post_form’s are actions, so should be the edit_forms. I don’t think any are filters, wouldn’t make sense…?

    This will help other plugins like my Signatures too.

    Less template edits needed, makes it easier for users.

    Of course I still have to support some 0.8.3 people so it’s going to be awhile before this solves all problems but at least newer installs can benefit.

    #64475

    In reply to: Hidden forums?

    fokjulle
    Member

    Just tested it, and it works. :-)

    #64448

    In reply to: IE 6 breaking tables.

    chrishajer
    Participant

    I was able to get it to display properly in IE6 by changing the CSS for the #frontpage #discussions.

    Old

    #front-page #discussions {
    margin-left: 170px;
    width: 590px;
    }

     

    New

    #front-page #discussions {
    float: right;
    width: 590px;
    }

     

    Basically, that change makes the #discussions div float to the right inside the #main div, rather than relying on the 170px of left margin. Not sure why IE6 does that and I didn’t investigate, but that fixed it for me. There might be other places you need to do that: I’m not sure. That was just for the home page of the forum.

    #64418
    fokjulle
    Member

    Here is config.php:

    <?php

    // ** MySQL settings ** //

    define(‘BBDB_NAME’, ‘*********’); // The name of the database

    define(‘BBDB_USER’, ‘********’); // Your MySQL username

    define(‘BBDB_PASSWORD’, ‘*********’); // …and password

    define(‘BBDB_HOST’, ‘**********’); // 99% chance you won’t need to change these last few

    define(‘BBDB_CHARSET’, ‘utf8’); // If you are *upgrading*, and your old bb-config.php does

    define(‘BBDB_COLLATE’, ”);

    define(‘BB_LANG’, ”); // not have these two contstants in them, DO NOT define them

    // If you are installing for the first time, leave them here

    // Change BB_SECRET_KEY to a unique phrase. You won’t have to remember it later,

    // so make it long and complicated. You can visit https://www.grc.com/passwords.htm

    // to get a phrase generated for you, or just make something up.

    // If you are integrating logins with WordPress, you will need to match the value

    // of the “SECRET_KEY” in the WordPress file wp-config.php

    define(‘BB_SECRET_KEY’, ”); // Change this to a unique phrase.

    // If you are running multiple bbPress installations in a single database,

    // you will probably want to change this.

    $bb_table_prefix = ‘bb_’; // Only letters, numbers and underscores please!

    // Change this to localize bbPress. A corresponding MO file for the

    // chosen language must be installed to bb-includes/languages.

    // For example, install de.mo to bb-includes/languages and set BB_LANG to ‘de’

    // to enable German language support.

    define(‘BB_LANG’, ”);

    /* Stop editing */

    if ( !defined(‘BB_PATH’) )

    define(‘BB_PATH’, dirname(__FILE__) . ‘/’ );

    require_once( BB_PATH . ‘bb-settings.php’ );

    ?>

    Yes, I use PHPMyAdmin…

    #63043
    Sam Bauers
    Participant

    The target attribute is deprecated (for those who care), use this instead:

    <?php
    /*
    Plugin Name: Links in new window
    */
    //add onclick="window.open(this.href); return false;" to post links
    function bb_links _in_new_window( $text ) {
    $text = preg_replace('|<a (.+?)>|i', '<a $1 onclick="window.open(this.href); return false;">', $text);
    return $text;
    }
    add_filter('pre_post', 'bb_links _in_new_window');
    ?>

    #62228
    _ck_
    Participant

    HowToGeek, that’s easily doable, just more settings to fill out ;-)

    That reminds me that I’ll have to give a list of accepted file types and sizes above or below the upload form.

    #62513
    _ck_
    Participant

    The ticket was months back, I’d have to search.

    It’s fairly simple in theory though, why not mimic the existing hook structure for new posts to match editing existing posts:

    pre_post_form -> pre_edit_form

    post_form -> edit_form

    post_post_form -> post_edit_form

    #63042
    chrishajer
    Participant

    Courtesy of _ck_ http://ckon.wordpress.com/2007/07/12/bbpress-plugin-bb-tweaks/

    <?php
    /*
    Plugin Name: Target Blank
    Description: append target="_blank" to all links
    Plugin URI: http://ckon.wordpress.com/2007/07/12/bbpress-plugin-bb-tweaks/
    Author: _ck_
    Version: 0.04
    */
    //add target=_blank to post links
    function bb_target_blank( $text ) {
    $text = preg_replace('|<a (.+?)>|i', '<a $1 target="_blank">', $text);
    return $text;
    }
    add_filter('pre_post', 'bb_target_blank');
    ?>

    #64413
    Sam Bauers
    Participant

    I imagine you have this set in your bb-config.php:

    define('BBDB_COLLATE', 'utf8_general_ci');

    .

    When it should be (in your case):

    define('BBDB_COLLATE', 'latin1_swedish_ci');

    #64345

    In reply to: IE: error on page.

    chrishajer
    Participant

    Crossed posts. :-) I found your ticket at trac after I suggested posting a new one there.

    Thanks.

    #64343

    In reply to: IE: error on page.

    chrishajer
    Participant

    When I was not logged in, no errors. When logged in, I see a Javascript error:

    Error: favoritesToggle[1 === isFav ? "removeClass" : "addClass"] is not a function
    Source File: http://trashmedia.co.za/forums/bb-includes/js/topic-js.php?ver=20080401
    Line: 55

     

    I have a 0.9.0.1 installation and I checked there and I have the same exact same error.

    It looked like the error was related to favorites, so I figured I would mark something as a favorite and see if the error would go away, but it didn’t.

    There is already a ticket filed for this problem with a solution posted there as well:

    https://trac.bbpress.org/ticket/851

    #64412
    chrishajer
    Participant

    I have no idea what that is, but I can try and help until someone more knowledgeable comes along.

    Did you set any of these three lines to something different than the default in your bb-config.php:

    define('BBDB_CHARSET', 'utf8');
    define('BBDB_COLLATE', '');
    define('BB_LANG', '');

     

    I found this online:

    http://www.datutorials.com/mysql/mysql_ref_manual_Charset.php

    What is your MySQL version?

    #64426

    In reply to: Favicons.

    chrishajer
    Participant

    Add this to the header.php in your template:

    <link rel="shortcut icon" href="<?php bb_option('uri'); ?>favicon.ico" type="image/vnd.microsoft.icon" />

    Then, make sure you have a favicon.ico in your forum’s root directory. You could also put the favicon in another directory (like the website root folder) and reference it there like this <link rel="shortcut icon" href="/favicon.ico" type="image/vnd.microsoft.icon" /> instead.

    http://en.wikipedia.org/wiki/Favicon

    #3229
    jenz
    Member

    I really like how this works on the front page:

    $forum_id = 1;

    $forum_one_topics = $bbdb->get_results("SELECT * FROM $bbdb->topics WHERE forum_id = $forum_id ORDER BY topic_time DESC LIMIT 0,10")

    foreach($forum_one_topics as $topic) :

    ?>

    but would like to use this for the whole site. Is it possible to make this the logic of the entire site loop?

    #51585
    jenz
    Member

    If I used:

    <?php
    $forum_id = 1;
    $number_of_topics = 7;
    $forum_one_topics = $bbdb->get_results("SELECT * FROM $bbdb->topics WHERE forum_id = $forum_id ORDER BY topic_id DESC LIMIT 0,$number_of_topics")
    ?>
    <?php
    foreach($forum_one_topics as $topic) : $forum_one_topic_posts = get_thread( $topic->topic_id); ?>

    (as see at the beginning of this topic) – how can I show the initial topic time on the front page instead of the last reply time?

    #64406
    chrishajer
    Participant

    I think you would probably want to edit the template files to include those blocks of code from your static page into bbPress, not the other way around. bbPress needs to do its thing, but you can edit the template files and include the sidebar and header into the bbPress pages.

    #62510
    _ck_
    Participant

    fel64: No, there’s been hooks for the post form for as long as I can remember.

    Unfortunately that’s only for new posts. For editing existing posts there is absolutely no way to affect the template without editing it. There’s no hooks for edit_form() or any of it’s sub-functions or the template loader (the loader does the include AFTER the hook so nothing can be placed afterwards. I requested some hooks many month ago but they may have been missed (or ignored). This plugin will require (one, simple) edit of the edit-post.php template.

    (In theory it could be done via the bb_get_footer but that’s really messy and the footer hook is AFTER the footer has been rendered).

    #64359
    citizenkeith
    Participant

    glanceup: Just cut and paste it into a plugin template. Here’s what I did (apologies to _ck_ if the headers aren’t quite right):

    <?php

    /*

    Plugin Name: Fix Number of Front Page Topics

    Plugin URI: https://bbpress.org/forums/topic/how-to-restrict-number-of-latest-discussions-on-front-page

    Description: Fix Number of Front Page Topics

    Author: _ck_

    Author URI: http://bbshowcase.org/

    Version: 0.1

    */

    // fix number of front page topics
    function bb_custom_topic_limit($limit) {
    switch (bb_get_location()) :
    case 'front-page': $limit=5; break;
    case 'forum-page': $limit=10; break;
    case 'tag-page': break;
    case 'topic-page': $limit=15; break;
    case 'feed-page': break;
    case 'search-page': break;
    case 'profile-page': break;
    case 'favorites-page': break;
    case 'view-page': $limit=10; break;
    case 'stats-page': break;
    case 'login-page': break;
    default: $limit=15;
    endswitch;
    return $limit;
    }
    add_action( 'bb_get_option_page_topics', 'bb_custom_topic_limit',200);

    // required to fix for custom topic limits to calculate correct page jumps
    function fix_post_link ($link,$post_id) {
    global $topic;
    remove_action( 'bb_get_option_page_topics', 'bb_custom_topic_limit' );
    if ($topic && $topic->topic_last_post_id==$post_id) {
    $topic_id=$topic->topic_id;
    $page=get_page_number( $topic->topic_posts );
    } else {
    $bb_post = bb_get_post( get_post_id( $post_id ) );
    $topic_id=$bb_post->topic_id;
    $page = get_page_number( $bb_post->post_position );
    }
    return get_topic_link( $topic_id, $page ) . "#post-$post_id";
    }
    add_filter( 'get_post_link','fix_post_link',10, 2);

    ?>

    glanceup
    Member

    ck — Into what file and where do I paste that code? Thanks. PS I am using bbPress 9.0.1

    #64382
    bobbyh
    Member

    Thanks for your thoughtful response, sam! That sounds great to me! :-)

    FYI, I also came across this query repeatedly in my slow query log:

    SELECT SQL_CALC_FOUND_ROWS * FROM bb_topics WHERE topic_status = 0 AND forum_id = 1 AND topic_sticky = 0 ORDER BY topic_time DESC LIMIT 40, 20;

    topic_sticky isn’t indexed (in either 0.83 or 0.91, I checked both). Should it be? It’s a tinyint(1), so indexing it should cost very little while improving performance a lot, I think?

    #64109

    Sorry to bump this thread again…

    Sambauer, my post was not directed to you and I respect a lot what you are doing and your attitude on the forum. It’s the “then go for a wiki” remark that made me react.

    I’m very happy and thankful that _ck_ got down to the writing of this plugin. Keep on the good works, it’s a great soft you’re all working on :)

    #62501

    _ck_ you are wonderful :)

    #62499
    Sam Bauers
    Participant

    It was USD$50

    :)

    I say just get it up to a usable state and out the door. Then we can all work on making it better over time.

    #62498
    _ck_
    Participant

    Whoa, $50 AUS? That’s like half a million US $ right now! I could buy 3, maybe even 4 gallons of gas (if I owned a car) LOL! :D

    Seriously though, many thanks, that’s a massive donation. Now I feel guilty like I have to make this an amazing plugin. Hope I can live up to it. I should have an early alpha for review Sunday or Monday night…

    #64380
    Sam Bauers
    Participant

    So how about the following?:

    bb_forums -> Add a unique key to forum_slug

    bb_topics -> Add a unique key to topic_slug

    bb_users -> Already has a unique key on user_nicename

    bb_tags -> Already has a key on tag which should be changed to a unique key

Viewing 25 results - 27,826 through 27,850 (of 32,495 total)
Skip to toolbar