Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 26,551 through 26,575 (of 32,495 total)
  • Author
    Search Results
  • #66117
    Gregg
    Member

    Im integrating my second wp and bb site and this time around it seems there are some easier steps only I cant get this setup to work. I can login to the WP side fine. But when i login from bb side it just redirects to the forum homepage. It will login the person on the wp side but not let them do a thing on the bb side.

    I dont have admin access until wipe out the theme and clear the cookies. its very strange.

    I followed all steps correctly in the writeup. any help would be much appreciated.

    here is what my bb-config file looks like

    require_once('/path/to/blog/wp-blog-header.php');

    // ** MySQL settings ** //

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

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

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

    define(‘BBDB_HOST’, ‘localhost’); // 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’, ”); // not have these two contstants in them, DO NOT define them

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

    define(‘COOKIEPATH’, ‘/’ );

    define(‘SITECOOKIEPATH’, ‘/’);

    // 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’, ‘secretkeydotcom’); // 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’ );

    $bb->wp_siteurl = ‘http://www.site.com/blog/’;

    // that’s your WordPress URL, not bbPress

    $bb->wp_home = ‘http://www.site.com/blog/’;

    // almost always the same as siteurl unless you tinker

    $bb->wp_table_prefix = ‘wp_’;

    // should almost always be wp_ unless you tinkered

    $bb->user_bbdb_name = ‘db’;

    // this is the MYSQL database name for *WordPress*

    // you can copy it right out of WordPress !

    $bb->user_bbdb_user = ‘user’;

    // this is the MYSQL user name for *WordPress*

    // you can copy it right out of WordPress !

    $bb->user_bbdb_password = ‘pswd’;

    // this is the MYSQL password for *WordPress*

    // you can copy it right out of WordPress !

    $bb->user_bbdb_host = ‘localhost’;

    // 99.9% of the time it’s going to be localhost, unless you are on DreamHost or some other weird ISP

    $bb->custom_user_table = ‘wp_users’;

    // 99.9% of the time it’s going to be wp_users

    $bb->custom_user_meta_table = ‘wp_usermeta’;

    // 99.9% of the time it’s going to be wp_usermeta

    $bb->authcookie = ‘wordpress_randomnumbers’;

    // in theory you should be able to leave this out

    // but this is going to be copied from WordPress cookie

    // this *must* match the WordPress setting

    // do NOT use the 1234567 part, use your own cookiehash from WordPress – see the note at the very bottom

    $bb->cookiedomain = ‘.site.com’;

    // note the leading DOT – this is important

    // this *must* match the WordPress setting

    $bb->cookiepath = ‘/’;

    // I *highly* recommend you set the cookie path to /

    // this *must* match the WordPress setting

    $bb->sitecookiepath = ‘/’;

    // I *highly* recommend you set the cookie path to /

    // this *must* match the WordPress setting

    //tried this – doesnt work with or without…ugh

    $bb->usercookie = ‘wordpressuser_randomnumbers’;

    $bb->passcookie = ‘wordpresspass_randomnumbers’;

    #68877
    _ck_
    Participant

    Any guide that is for WordPress plugins should work for bbPress, it’s just that bbPress’s “hooks” (do_action, do_filter) will be named differently.

    bbPress is unfortunately too young to have decent documentation yet. WordPress itself didn’t really “take off” until 2.0 beta came out.

    This is essentially the plugin framework you need:

    <?php
    /*
    Plugin Name: My Tag Sort
    */
    remove_filter('sort_tag_heat_map', 'bb_sort_tag_heat_map');
    add_filter('sort_tag_heat_map', 'my_sort_tag_heat_map');

    function my_sort_tag_heat_map( &$tag_counts ) {
    // put your replacement code here
    }
    ?>

    Save it as my-tag-sort.php, put it into the bbpress/my-plugins folder, activate and you’re in business (well after you figure out the sort method).

    Typically you’d have to do a return $tag_counts; at the end of a filter but that & on the &$tag_counts means it’s “passed by refererence” which is a fancy way of using the original array directly without making a copy, so the original is changed at the source when you modify it. It’s a much faster way to move large amounts of info around.

    #68560
    jonkristian
    Member

    Deadpan11 , I followed your guide and it worked excellent, however I had to keep the hash on:

    $bb->logged_in_cookie = ‘wordpress_logged_in_’;

    Setup, http://forums.domain.com & http://domain.com

    I can now log in via the forums, and access both admin panels, and via wp, and still access both. If I log out of either, I am logged out of both. :)

    #68874
    myu
    Member

    Thanks for reply, ck.

    I didn’t know how to make plugins..

    So, anywhere that say

    apply_filter('___', '___');

    can be replaced?

    Now.. about original question:

    $tag_counts is

    • key: raw_tag
    • value: how many times topics are tagged with this tag

    Googling a bit more made me realize, there’re problems associated with ordering Japanese words/strings as there’re 2 types of letters and chinese character used.

    strnatcasecmp() seem to put things in order of

    1. hiragana in ascending
    2. katakana in ascending
    3. chinese characters in encoding#

    ssetlocale(LC_COLLATE, "jp", "jpn");
    ksort($tag_counts, SORT_LOCALE_STRING);

    shows exactly the same result.

    It seems pretty impossible (for me) to order them.

    I will flip it to descending, with krsort(); just so the tag “other” won’t come to start.

    #68899
    _ck_
    Participant

    WordPress allows you to make links, go to manage->links under your control panel. Make the link /forums/ if that’s the path to your forums.

    There are also wordpress plugins to make menu bars, optionally you could use that and put a few primary site links in there, including one to your forums.

    Technically if you wanted to place a link more prominently under your pages section, you could actually create a page for the forums and then use the rewriterules in your .htaccess to redirect the user to the actual forums.

    #63069
    TrishaM
    Participant

    Thanks _ck_ – I’ll do as suggested…….

    P.S. At cafepress.com you can design your own bumper sticker! I’ve made a few of my own t-shirts that way…..perfect for when you know just what you want but can’t find it anywhere…. :)

    #63068
    lstelie
    Member

    People who insist on perfect validation need to find more productive things to do with their time, there’s alot of code out there that needs to be written! ;-)

    Good point :)

    #63067
    _ck_
    Participant

    TrishaM, if you are using bb-tweaks.php you can just add the above code to the bottom of it and disable the target_blank filter. But it will work either way.

    lstelie, there is another problem with using javascript as it increases the amount of time before the page is ready. If you are going to throw in rel=”external” you might as well do target. (In fact, you don’t even need rel=”external” as you can scan the domain for each link with javascript on the fly.) But I assure you that target will be supported in browsers ten years from now, maybe even twenty. People who insist on perfect validation need to find more productive things to do with their time, there’s alot of code out there that needs to be written! ;-)

    Throw off the shackles of validation!

    (I need that as a bumper sticker)

    #63066
    lstelie
    Member

    Hello,

    I use for a pretty long time rel=”external” more compliant and this works well.

    The following bit of code is from

    http://www.sitepoint.com/article/standards-compliant-world

    function externalLinks() {
    if (!document.getElementsByTagName) return;
    var anchors = document.getElementsByTagName("a");
    for (var i=0; i<anchors.length; i++) {
    var anchor = anchors;
    if (anchor.getAttribute("href") &&
    anchor.getAttribute("rel") == "external")
    anchor.target = "_blank";
    }
    }
    window.onload = externalLinks;

    If JS is not activated ? well no external link but the site is prefectly working

    #68487

    In reply to: Customizing gravatars

    Okay, having tested it a bunch of different ways, I can’t get it to work.

    I want to make my own image the ‘default’ for the non-gravatard people (which works fine on WordPress).

    In WordPress it’s this:

    <?php echo get_avatar(get_comment_author_email(),50,'http://www.foo.com/gravatar.png');?>

    For bbpress we have this post_author_avatar(); on post.php. Passing the URL into that, either on it’s own or as $default doesn’t work.

    Using echo bb_get_avatar( bb_get_user_email(post_author()), 48, 'http://www.foo.com/gravatar.png' ); didn’t work.

    I’m gonna keep tossing stuff up against the wall for now.

    #68873
    _ck_
    Participant

    It uses the action

    do_action_ref_array( 'sort_tag_heat_map', array(&$counts) );

    which looks like

    function bb_sort_tag_heat_map( &$tag_counts ) {
    uksort($tag_counts, 'strnatcasecmp');
    }

    So it was designed to be replaced fortunately.

    First to have to unhook the existing action in your plugin:

    remove_filter('sort_tag_heat_map', 'bb_sort_tag_heat_map');

    Then put in your replacement

    add_filter('sort_tag_heat_map', 'my_sort_tag_heat_map');

    function my_sort_tag_heat_map( &$tag_counts ) {
    // put your replacement code here
    }

    According to this, it’s supposed to support your locale, but there is a bug:

    http://us.php.net/strnatcasecmp

    #68559

    So the web-consensus is that

    $bb->cookiedomain = '.domain.com';

    specifically the leading dot before the domain.com, is key to permitting cookies created in one subdomain to be useful in other related domains.

    Darn. I thought I found my magic bullet.

    #68883

    In reply to: Customize Topic Labels

    remove_filter('bb_topic_labels', 'bb_sticky_label', 20); worked.

    Now it has images :)

    #63064
    _ck_
    Participant

    Okay this one is testing working.

    For anyone else that wants to use this, you have to replace the domain name by hand. It’s hardcoded for speed, sorry.

    All other target=”_blank” plugins should be uninstalled. Any existing links with target=”_blank” will be left in place for performance since target is not added by bbPress by default.

    <?php
    /*
    Plugin Name: Target Nofollow External Only
    Description: append target="_blank" and rel="nofollow" only on external links
    Plugin URI:
    Author: _ck_
    Version: 0.0.1
    */

    add_filter('post_text', 'target_nofollow_external_only',999); // unfortunately we have to do this on every page load and not in pre_post

    function target_nofollow_external_only( $text ) {
    $domain="travel-writers-exchange.com"; // domain to exclude from target and nofollow
    $text = preg_replace('|<a (.*)rel=['"]nofollow['"](.+)?>|iU','<a $1$2>', $text); // strip ALL nofollow
    $text = preg_replace('|<a (?=([^>]+http://))(?!([^>]+'.$domain.'))(.+)>|iU', '<a $3 rel="nofollow" target="_blank">', $text); // add back in when needed
    return $text;
    }
    ?>

    I’m not happy about the performance of this technique because it has to be done in post_text for every time a page is displayed, but there’s no other easy way around bbPress/WordPress’s unfortunate use of make_clickable with hardcoded “nofollow” in post_text.

    #63063
    _ck_
    Participant

    Okay I’ll play with it some more and see what I can do.

    update: the problem lies within make_clickable which has nofollow hard coded and impossible to “unfilter” at that level

    I’ll have to come up with a way to do it at display time and cleanup the mess bbpress (actually wordpress functions) create

    #68890
    chrishajer
    Participant

    You don’t normally need to set anything there. The installation will continue fine without it.

    Every MySQL database uses character collation, but it’s normally hidden from sight. For my bbPress installation, the collation is utf8_general_ci. But I didn’t have to set it, it’s already there. In a unique situation you might need to set it, but I’ve never messed with it.

    #63061
    TrishaM
    Participant

    Hmmm…..okay well I did add this code to bb_tweaks……I replaced the function bb_target_blank section with what you have here, and I removed the add_filter('pre-post','bb_rel_nofollow'); and added the remove_filter actions above…….but it did not seem to have any effect – bbPress still strips out any “target” reference and still adds the rel=”nofollow” to all links…..

    I haven’t made any other tweaks to this….

    #68882

    In reply to: Customize Topic Labels

    Okay, now it’s weird. It works perfect for bb_closed_label, but remove_filter('bb_topic_labels', 'bb_sticky_label'); does nothing.

    What I tried was

    remove_filter('bb_topic_labels', 'bb_sticky_label');
    function my_sticky_label( $label ) {
    global $topic;
    if (is_front()) {
    if ( '2' === $topic->topic_sticky ) {
    return sprintf(__('<img src="/images/sticky.png" /> %s'), $label);
    }
    } else {
    if ( '1' === $topic->topic_sticky || '2' === $topic->topic_sticky ) {
    return sprintf(__('<img src="/images/sticky.png" /> %s'), $label);
    }
    }
    return $label;
    }
    add_filter('bb_topic_labels', 'my_sticky_label');

    When I do that I get [sticky] and then my image. Which is close…

    #68864

    My first thought on just copying index.php over and changing require('./bb-load.php'); to require('./forums/bb-load.php'); didn’t work (which is how it works for wordpress), though it may work if you do that and then changed the location in settings.

    See https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory for ideas?

    #68880

    In reply to: Customize Topic Labels

    _ck_
    Participant

    You don’t have to hack anything, it’s done via a filter.

    ie.

    add_filter('bb_topic_labels', 'bb_closed_label', 10);
    add_filter('bb_topic_labels', 'bb_sticky_label', 20);

    simply remove the filter via a plugin and replace it with your own routine.

    remove_filter('bb_topic_labels', 'bb_closed_label');
    add_filter('bb_topic_labels', 'my_closed_label');
    function my_closed_label( $label ) {
    global $topic;
    if ( '0' === $topic->topic_open )
    return sprintf(__('[Read Only] %s'), $label);
    return $label;
    }

    #4249

    In bb-includes/formatting-functions.php the values of the closed and sticky labels are hard coded:

    function bb_closed_label( $label ) {
    global $topic;
    if ( '0' === $topic->topic_open )
    return sprintf(__('[closed] %s'), $label);
    return $label;
    }

    I want to change ‘closed’ to ‘Read Only’. I know I can just hack the file, but there should be a way to use theme functions and I’m just not thawed out enough to think of it.

    #68871
    _ck_
    Participant

    bb-attachments lets you upload an image and it inserts a simple bbcode for you automatically

    #68870
    chrishajer
    Participant

    Step 3:

    Do you need to install a language other than English? If so, you can find a list of language files here:

    http://bbshowcase.org/forums/topic/bbpress-translation-internationalization-into-local-languages

    If you need to use a language other than English, you need to navigate to the folder bb-includes and create a folder inside that folder, called languages, then put the language files in there.

    Step 4:

    If your website is http://www.example.com, and you put your forum in a directory called forum, you would open a browser and go to http://www.example.com/forum/ and the installer will start for you.

    #4245
    Jeff Waugh
    Member

    Here’s a quick tip for anyone running an integrated WP+BB setup…

    Sometimes you’ll find users who haven’t been properly mapped into bbPress roles, so here is a quick MySQL statement to make them all members:

    insert into wp_usermeta (user_id, meta_key, meta_value) select user_id, 'bb_capabilities' as meta_key, 'a:1:{s:6:"member";b:1;}' as meta_value from wp_usermeta where user_id not in (select user_id from wp_usermeta where meta_key = 'bb_capabilities') group by user_id;

    (It adds a bb_capabilities record to the wp_usermeta table for each user who doesn’t have one. Thus, broken accounts become members. Yay!)

    Have fun. :-)

    #63060
    _ck_
    Participant

    Well we could cheat and make the plugin skip links that have your domain name or no http:// in it.

    function bb_target_blank( $text ) {
    $text = preg_replace('|<a (?=http://)(?!travel-writers-exchange.com)(.+?)>|i', '<a $3 rel="nofollow" target="_blank">', $text);
    return $text;
    }

    This is untested.

    It’s a fancy regex feature called negative lookahead.

    Try it and see what happens.

    Doing nofollow for only externals is essentially the same thing, I’ve added it to the replacement above.Make sure you have no additional tweaks for nofollow. I don’t think it’s on by default? If so, try

    remove_filter('post_text', 'bb_rel_nofollow');
    remove_filter('pre_post', 'bb_rel_nofollow');

Viewing 25 results - 26,551 through 26,575 (of 32,495 total)
Skip to toolbar