Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 26,526 through 26,550 (of 32,466 total)
  • Author
    Search Results
  • #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');

    #68831
    TrishaM
    Participant

    I use TextWrangler, from BareBones software – it’s a free text editor that has a lot of the features of their pay-for text editor, BBEdit (it replaced BBEdit Lite). To the best of my knowledge it’s not supposed to do something like that (pasting whitespace) and I haven’t had trouble in the past, but you never know – it could have been something in the process of copying it from my browser window after running rewrite-rules.php and then pasting it into TextWrangler that added some whitespace….

    I’ll definitely keep that in mind next time I’m copying and pasting anything…….

    And you’re welcome for the donation – as mentioned it was very well deserved! I’m self-employed and have a tiny budget, but I always try to reward plugin and theme developers, especially when they are so nice about providing support that goes way above and beyond the norm as you have :)

    #63057
    TrishaM
    Participant

    Bump – I know this may wind up being a dead issue (at least until a future bbPress update), but is anyone aware of any plugin to give greater control over how links are handled?

    I don’t want to dig into the core files, but I need to have internal links handled differently from external links, and need to be able to not have manually entered links (not using the URL button) altered to remove or add anything to the <a>tag…..so I’m hoping a plugin exists that will allow for link customization….

    #68631
    _ck_
    Participant

    I now have this working as a plugin and will make it available later today. I expect donations from both of you considering the small fortunes you were willing to pay an outsider ;-)

    #68630
    _ck_
    Participant

    I suggested they change this in the core long ago and let the user choose passwords while sending only an activation link via email.

    If you don’t need them to verify via a link in the email this could be written in an hour as a plugin. The code for password entry with re-entry verification can be lifted from the 1.0 alpha source.

    I do recommend you use my Human Test plugin however.

Viewing 25 results - 26,526 through 26,550 (of 32,466 total)
Skip to toolbar