Search Results for 'code'
-
AuthorSearch Results
-
December 17, 2007 at 11:07 am #60927
In reply to: DB access problem in the first installation step.
Asbjørn Ulsberg
MemberThere is still a set of problems with this. The value of
$this->$dbhnameisn’t checked before it’s used inmysql_get_server_info()on line 75 indb-mysqli.php. If the connection fails, the error won’t be echoed to the user because the use of@on themysql_connect()call and then the script just continues, assuming the connection went fine, which in my case, it din’t. Also, the call should be tomysql<b>i</b>_connect()and notmysql_connect(), as far as I can understand.The patch doesn’t fix these problems and they need to be fixed for bbPress to work on my host. I’d write these comments on the associated ticket, but there doesn’t seem to be any way to register or comment anonymously there.
December 17, 2007 at 10:41 am #60854Asbjørn Ulsberg
MemberI have the same problem and overwriting
db-mysqli.phpwithdb.phpdidn’t help. Just for completeness, here’s the error messages I encounter:Warning: mysql_get_server_info() [function.mysql-get-server-info]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /home/<snip>/bbpress/bb-includes/db-mysqli.php on line 73I suspect bbPress of having hard coded a connection to
localhostand thus configuringdefine('BBDB_HOST', '...')to be something else thanlocalhostdoesn’t really matter. I don’t have MySQL and Apache installed on the same physical server, so I have to access MySQL through a hostname and thuslocalhostwon’t work.December 17, 2007 at 9:14 am #2712Topic: Posts lost :(
in forum Troubleshootingr4zv4n
MemberThis morning when I logged in, I noticed a big chunk of the posts on my forum were gone. I still have posts from the beginning and some recent ones, but a large batch of posts from the middle was lost

Any ideas on why or how I could get them back ?
December 17, 2007 at 7:28 am #62071In reply to: Installation woes
chrishajer
ParticipantYou really, really, really need to upgrade your WordPress:
<meta name="generator" content="WordPress 1.5.1.2" />Until then, I think it would be silly to try and fix any errors in your install.
Current WordPress version is 2.3.1: 1.5.1.2 was released 2.5 years ago and has security issues as well as limited functionality.
December 17, 2007 at 6:36 am #61878In reply to: Limiting RSS Feed to First Post Only
livibetter
MemberHere is a temporary solution:
rss.php: http://llbb.pastebin.com/f5c1a8a37rss2.phpof template: http://llbb.pastebin.com/f24cd6fd3If you need the last post content of each topic, please find a recent topic
Excerptand combine this with it.Edit: Oops… just find out you are also the starter of that topic.
December 17, 2007 at 6:31 am #62031In reply to: Forum linking back to blog page
chrishajer
ParticipantIt’s working for me. I clicked on some forum names and was brought to a page that listed that forum name. There were no topics though so it said “you must be logged in to post.” So, I created an account and I can look around and everything looks normal.
If any link that had ‘forum’ in it redirected to the main blog, my guess is you had a permalink issue. I would set your mod_rewrite line to false for the time being (which you may have done already to get it working, since it seems to be fine right now.)
$bb->mod_rewrite = false;December 17, 2007 at 6:26 am #62069In reply to: Installation woes
chrishajer
ParticipantWhy is your bbPress calling a WordPress function?
wp-includes/functions.phpIs there more to your setup than it appears?
Actually, I just went to your forum and it is working?
December 17, 2007 at 4:15 am #61875In reply to: Limiting RSS Feed to First Post Only
Doobus
MemberAfter all my slicing and dicing with bbPress, I’m finally coming close to completing everything, except one thing. This RSS thing is really killing me
. I’m wracking my brain trying to explain this the best way possible. So here I go. Each forum has a feed, how do I only show the topics in the feed? As it stands right now, the feed is showing the replies as well, I just want topics to show.
Sorry for sounding redundant, but I’m desperate >_< to complete. Thanks in advance.
December 16, 2007 at 11:22 pm #62054In reply to: Having trouble integrating WP functions
livibetter
MemberThe workaround won’t work for plugins.
@sambauers: I think there is no complete working solution if you don’t touch the core files.
First, load_default_textdomain and load_plugin_textdomain are WordPress version, they only look language files in WordPress directories. So, in bbPress, all text won’t be translated since language file are not loaded because WordPress load_*_textdomain won’t find language files in bbPress’ directories.
Second, WordPress and bbPress both use
defaultas textdomain when calling __() or _e() without assigning textdomain, that means we can only use either WordPress’ or bbPress’ language files at the same time, not both.(edit: plugin’s problem can be solved by add a bb_load_plugin_textdomain, but bbPress’s part. If we don’t want to use something like bb__(), bb_e(), maybe we can try to merge bbPress translations into WordPress’ in runtime? or search bbPress’ first, then WordPress’ if can’t find)
December 16, 2007 at 11:11 pm #62052In reply to: Having trouble integrating WP functions
livibetter
MemberSorry, didn’t read bbPress source carefully. Replace first if clause with
if ( defined('BBLANG') && '' != constant('BBLANG') ) {
if ( function_exists('load_default_textdomain') ) {
global $l10n;
$locale = BBLANG;
$mofile = BBPATH . BBINC . 'languages/' . "$locale.mo";
if ( is_readable($mofile) ) {
$input = new CachedFileReader($mofile);
$l10n['default'] = new gettext_reader($input);
}
}
else {
include_once(BBPATH . BBINC . 'streams.php');
include_once(BBPATH . BBINC . 'gettext.php');
}
}PS. That “..” is how you put variable to be parsed in string in PHP ( Variable parsing )
December 16, 2007 at 10:56 pm #62048In reply to: Having trouble integrating WP functions
ixray2
Membertried out your workaround, does not seem to work (doesn’t load language file).
also, shouldn’t it be
$mofile = BBLANGDIR . $locale . ".mo";?but even with that fixed, it doesn’t work.
but still, thanks a lot!!
December 16, 2007 at 10:55 pm #62047In reply to: Having trouble integrating WP functions
livibetter
MemberSeems you will use a lot of stuff from WordPress. If your WordPress template is already written in German, then you should have no problems. If not or some functions use
gettextfunctions, then you will see many text in original language.December 16, 2007 at 10:51 pm #62045In reply to: Having trouble integrating WP functions
livibetter
MemberThis is a quick workaround:
if ( defined('BBLANG') && '' != constant('BBLANG') ) {
if ( function_exists('load_default_textdomain') ) :
global $l10n;
$locale = BBLANG;
$mofile = BBLANGDIR . "$locale.mo";
load_textdomain('default', $mofile);
else:
include_once(BBPATH . BBINC . 'streams.php');
include_once(BBPATH . BBINC . 'gettext.php');
endif;
}
if ( !( defined('DB_NAME') || defined('WP_BB') && WP_BB ) ) { // Don't include these when WP is running.
require( BBPATH . BBINC . 'kses.php');
if ( !function_exists('load_default_textdomain') )
require( BBPATH . BBINC . 'l10n.php');
}It should drops WordPress’ language file, and replaces with bbPress’. That means translations need to be done in WordPress won’t be translated since this code drops language file. This wont happen when you read your blog. However, I don’t have any language files, so this is coded by guessing.
This is not a solution, just a temporary fix. I will file a ticket.
December 16, 2007 at 10:24 pm #62042In reply to: Having trouble integrating WP functions
livibetter
MemberReproduced.
I didn’t use any language files. But after I put a language code in
bb-config.php(for r988) andwp-config.php, I got a blank page.Don’t know if I can fix this.
December 16, 2007 at 9:55 pm #62040In reply to: Having trouble integrating WP functions
livibetter
MemberThen, you should trace in bbPress’ code to find out where causes an exit.
BTW, you can also test
error_log(get_option('blogname'));to make sure WordPress loaded database correctly.PS. debugging with no debugger is a crazy thing. You have to guess by experiences for best shot.
December 16, 2007 at 9:40 pm #62038In reply to: Having trouble integrating WP functions
livibetter
MemberI don’t have any clues to solve you problem.
If I were you, I will
1. put
error_log('WordPress loaded');after thatrequest_onceto make sure wp has been loaded.2. check error log for
WordPress loaded, if I get that, that means the problem should be on bbPress, or on WordPress.3. keep using error_log, find out where causes a program end.
This is my no-debugger-debugging method.
December 16, 2007 at 8:38 pm #62035In reply to: Having trouble integrating WP functions
livibetter
MemberWell, I didn’t mean that kind of error message. If your hosting provider gives you cpanel, there should be a “Error Logs”
And put that line top of original
config.phpis correct, but to bottom isn’t.Maybe you can try to use relative path? (I don’t think this will help…)
What are the versions of WordPress and bbPress which you are using?
Still need the error log.
December 16, 2007 at 4:39 pm #62026In reply to: constant BBDB_HOST problem
chrishajer
ParticipantIt will support a host name, but are you trying to use a port or a socket? I use MySQL servers on different hosts all the time, but they are always on the default port of 3306.
Can you post the
BBDB_HOSTline from your config.php?Also, you didn’t post the actual warnings: what were those?
livibetter
Memberfel64 is right. So I made a change.
<?php
// from wp_trim_excerpt() in WordPress 2.3.1 formatting.php, just removed few lines
function make_excerpt($text) { // Fakes an excerpt if needed
$text = str_replace(']]>', ']]>', $text);
$text = strip_tags($text);
$excerpt_length = 55;
$words = explode(' ', $text, $excerpt_length + 1);
if (count($words) > $excerpt_length) {
array_pop($words);
array_push($words, '[...]');
$text = implode(' ', $words);
}
return $text;
}
if ( $topics ) :
$last_post_ids = array();
foreach ( $topics as $topic )
$last_post_ids[] = $topic->topic_last_post_id;
global $bbdb;
$post_ids = $bbdb->get_col( "SELECT post_id, post_text FROM $bbdb->posts WHERE post_id IN (" . implode(',', $last_post_ids) . ")");
$post_texts = $bbdb->get_col( null, 1 );
$post_excerpts = array();
foreach($post_ids as $idx => $post_id)
$post_excerpts[$post_id] = make_excerpt( $post_texts[$idx] );
endif;
?>
<?php if ( $topics ) : foreach ( $topics as $topic ) : ?>
<tr<?php topic_class(); ?>>
<td><?php bb_topic_labels(); ?> <a href="<?php topic_link(); ?>"><?php topic_title(); ?></a>
<?php echo $post_excerpts[$topic->topic_last_post_id]; ?>
</td>
<td class="num"><?php topic_posts(); ?></td>
<td class="num"><?php topic_last_poster(); ?></td>
<td class="num"><small><?php topic_time(); ?></small></td>
</tr>
<?php endforeach; endif; // $topics ?>On my test forum, 15 posts, without excerpts takes .119 sec, with excerpts takes .127 sec. Previous code takes .140 sec.
livibetter
MemberReplace the similar part with it in front-page.php (Kakumei):
<?php if ( $topics ) : foreach ( $topics as $topic ) : ?>
<tr<?php topic_class(); ?>>
<td><?php bb_topic_labels(); ?> <a href="<?php topic_link(); ?>"><?php topic_title(); ?></a>
<?php
// from wp_trim_excerpt() in WordPress 2.3.1 formatting.php, just removed few lines
function make_excerpt($text) { // Fakes an excerpt if needed
$text = str_replace(']]>', ']]>', $text);
$text = strip_tags($text);
$excerpt_length = 55;
$words = explode(' ', $text, $excerpt_length + 1);
if (count($words) > $excerpt_length) {
array_pop($words);
array_push($words, '[...]');
$text = implode(' ', $words);
}
return $text;
}
echo make_excerpt( get_post_text( $topic->topic_last_post_id ) );
?>
</td>
<td class="num"><?php topic_posts(); ?></td>
<td class="num"><?php topic_last_poster(); ?></td>
<td class="num"><small><?php topic_time(); ?></small></td>
</tr>
<?php endforeach; endif; // $topics ?>It generates an excerpt of latest reply of topic.
December 16, 2007 at 12:11 am #61976In reply to: Forums working great, but we cant log in S.O.S.
toxicshocktv
MemberI’m going to try a fresh reinstall and see if I can get it working, otherwise I’m off to Vbulletin.
December 15, 2007 at 11:46 pm #62020In reply to: database MINOR issue
Trent Adams
MemberGlad to help

Trent
December 15, 2007 at 11:18 pm #61974In reply to: Forums working great, but we cant log in S.O.S.
Trent Adams
MemberLogins and such are best used with default everything until you know they work. Try the default template again and report back any specific things you have going on there. As well, once you start fiddling with integrating with WP in the config.php it will use the WordPress members. Another thing if you don’t have Akismet setup would be to put:
$bb->akismet_key = false;Trent
December 15, 2007 at 11:15 pm #62010Trent Adams
Member#1) This is simple enough as MU is built for that.
#2) If you are talking about each member having their own bbPress forum as well in #2, I would suggest that would be a massive problem. If you just mean having them using a single forum, I think this can be done.
#3) Avatars can be down with many plugins you can find in these forums or over at https://bbpress.org/plugins/ . Combining with MU might be a little difficult or require a plugin. I would suggest looking around to see if anyone on MU has come up with a solution already. That or use Gravatar

#4) Combination of plugins and RSS feed grabbers could do that without very much hassle. What is written already might be sufficient from the plugins area, but a couple different database requests would make new plugins for this quickly I am sure.
#5) You didn’t have one

#6) People out there have successfully integrated bbPress and WordPressMU logins, but you might need to search a bit over at http://mu.wordpress.com/forums/ as well for the answer
It also depends on your answer to #2 though…..#7) You already know the answer and Null helped with the others.
Trent
Doobus
MemberI’m mediocre at best when it comes to php, so I’m a bit confused as to what to call, all I really know are the functions for WordPress, any code suggestions would be greatly appreciated.
-
AuthorSearch Results