Search Results for 'code'
-
AuthorSearch Results
-
November 12, 2008 at 7:40 am #68899
In reply to: I’m installed now how do I get readers to forums?
_ck_
ParticipantWordPress 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.
November 11, 2008 at 8:14 pm #63069In reply to: Open Links in new window
TrishaM
ParticipantThanks _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….
November 11, 2008 at 8:01 pm #63068In reply to: Open Links in new window
lstelie
MemberPeople 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
November 11, 2008 at 7:33 pm #63067In reply to: Open Links in new window
_ck_
ParticipantTrishaM, 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)
November 11, 2008 at 7:19 pm #63066In reply to: Open Links in new window
lstelie
MemberHello,
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
November 11, 2008 at 4:28 pm #68487In reply to: Customizing gravatars
Ipstenu (Mika Epstein)
ModeratorOkay, 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.
November 11, 2008 at 3:54 pm #68873In reply to: “alphabetical” ordering of hot tags
_ck_
ParticipantIt 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:
November 11, 2008 at 3:27 pm #68559In reply to: 1.0a2 + 2.6x cookies: so close!
WebDev WaxLotus LLC
MemberSo 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.
November 11, 2008 at 2:28 pm #68883In reply to: Customize Topic Labels
Ipstenu (Mika Epstein)
Moderatorremove_filter('bb_topic_labels', 'bb_sticky_label', 20);
worked.Now it has images
November 11, 2008 at 2:01 pm #63064In reply to: Open Links in new window
_ck_
ParticipantOkay 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.
November 11, 2008 at 12:25 pm #63063In reply to: Open Links in new window
_ck_
ParticipantOkay 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
November 11, 2008 at 8:37 am #68890In reply to: database character collation ?
chrishajer
ParticipantYou 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.November 10, 2008 at 8:26 pm #63061In reply to: Open Links in new window
TrishaM
ParticipantHmmm…..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….
November 10, 2008 at 8:09 pm #68882In reply to: Customize Topic Labels
Ipstenu (Mika Epstein)
ModeratorOkay, 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…
November 10, 2008 at 5:52 pm #68864In reply to: visit bbpress in root dir; store it elsewhere
Ipstenu (Mika Epstein)
ModeratorMy first thought on just copying index.php over and changing
require('./bb-load.php');
torequire('./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?
November 10, 2008 at 5:42 pm #68880In reply to: Customize Topic Labels
_ck_
ParticipantYou 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;
}November 10, 2008 at 5:34 pm #4249Topic: Customize Topic Labels
in forum PluginsIpstenu (Mika Epstein)
ModeratorIn 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.
November 10, 2008 at 7:29 am #68871In reply to: Adding Images to a Post Without Tags?
_ck_
Participantbb-attachments lets you upload an image and it inserts a simple bbcode for you automatically
November 10, 2008 at 5:56 am #68870In reply to: Installation procedure, can’t understand clearly…
chrishajer
ParticipantStep 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.November 10, 2008 at 12:29 am #4245Topic: Fixing WordPress-integrated users without membership
in forum TroubleshootingJeff Waugh
MemberHere’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.
November 9, 2008 at 5:59 pm #63060In reply to: Open Links in new window
_ck_
ParticipantWell 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');November 9, 2008 at 5:53 pm #68831In reply to: Topics Per Page plugin – new problem
TrishaM
ParticipantI 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
November 9, 2008 at 5:47 pm #63057In reply to: Open Links in new window
TrishaM
ParticipantBump – 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….November 9, 2008 at 8:37 am #68631In reply to: Allowing New Users to pick their own passwords
_ck_
ParticipantI 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
November 9, 2008 at 6:59 am #68630In reply to: Allowing New Users to pick their own passwords
_ck_
ParticipantI 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.
-
AuthorSearch Results