Search Results for 'code'
-
AuthorSearch Results
-
February 6, 2011 at 2:13 pm #99236
In reply to: import all topic and post from wordpress to bbpress
Ashish Kumar (Ashfame)
ParticipantIf you want to move your WordPress data to a bbPress install, then you can use this http://code.google.com/p/wordpress-to-bbpress-converter/
February 5, 2011 at 7:47 am #104003_ck_
ParticipantOkay I had never written the special routine for “topics to which each user has replied” so it never even appeared in the last 0.9 although Sam incorporated some of my other improved queries.
But I sat down and wrote it just for you now

http://bbshowcase.org/plugins/fast-recount.zip
Basically the old 0.9 bbPress api loops through each and every user and does a few queries for each one, completely overloading any server and timing out and never finishing.
ie. 6 queries per user x 1000 users = 6000 queries !!!!
My version accomplishes the exact same results with only a handful of queries right inside the mysql engine regardless of how many users, so it should always finish in under 30 seconds (unless perhaps it’s millions of users)
Once you install and activate, under your recount menu you will see (among others)
FAST RECOUNT topics to which each user has replied
So check that box and leave the old one unchecked.
Until I have some time to fix the order in which the boxes appear, you should probably do the fast recount AFTER the other regular counts are done.
Oh and last but certainly not least, I highly recommend backing up your mysql database for wordpress/bbpress before using this plugin, because it’s experimental and does actually delete old data before creating the new data. Something could go wrong (in theory you could run it a second time to fix the problem but always best to be safe).
ps. make sure you update bbpress to 0.9.0.6 too
February 5, 2011 at 7:47 am #98903_ck_
ParticipantOkay I had never written the special routine for “topics to which each user has replied” so it never even appeared in the last 0.9 although Sam incorporated some of my other improved queries.
But I sat down and wrote it just for you now

http://bbshowcase.org/plugins/fast-recount.zip
Basically the old 0.9 bbPress api loops through each and every user and does a few queries for each one, completely overloading any server and timing out and never finishing.
ie. 6 queries per user x 1000 users = 6000 queries !!!!
My version accomplishes the exact same results with only a handful of queries right inside the mysql engine regardless of how many users, so it should always finish in under 30 seconds (unless perhaps it’s millions of users)
Once you install and activate, under your recount menu you will see (among others)
FAST RECOUNT topics to which each user has replied
So check that box and leave the old one unchecked.
Until I have some time to fix the order in which the boxes appear, you should probably do the fast recount AFTER the other regular counts are done.
Oh and last but certainly not least, I highly recommend backing up your mysql database for wordpress/bbpress before using this plugin, because it’s experimental and does actually delete old data before creating the new data. Something could go wrong (in theory you could run it a second time to fix the problem but always best to be safe).
ps. make sure you update bbpress to 0.9.0.6 too
February 5, 2011 at 2:58 am #37352Topic: include bb-load.php
in forum Themesthebreiflabb
MemberIn the header on my wordpress theme I do
<?php include_once(ABSPATH."forum/bb-load.php"); ?>and it works on the front-page without any errors and I can call the bb functions etc. But on the other wordpress-pages I have it gives an error. And stops all html output where I include the file, the error is:
Fatal error: Call to a member function suppress_errors() on a non-object in /fakepath/public_html/forum/bb-includes/functions.bb-core.php on line 77Anything I can do to fix this?
February 4, 2011 at 11:09 pm #104321In reply to: Plugin Help – Getting User ID
Regina13
MemberThank you!
February 4, 2011 at 11:09 pm #99221In reply to: Plugin Help – Getting User ID
Regina13
MemberThank you!
February 4, 2011 at 10:25 pm #104270In reply to: Single login error – "Multiple user_login matches"
shawn2
MemberI have dropped my bb_ tables, removed bb_capabilities from _usermeta and deleted bb-config.php. I then reinstalled bbpress with integration settings. At the end of install I received the error Forum could not be created! I followed this advice: https://bbpress.org/forums/topic/forum-could-not-be-created and added a row to the forum table. When I try to login now I still receive the error “multiple user_login matches”
Anyone? Help? Please
!!!
February 4, 2011 at 10:25 pm #99170In reply to: Single login error – "Multiple user_login matches"
shawn2
MemberI have dropped my bb_ tables, removed bb_capabilities from _usermeta and deleted bb-config.php. I then reinstalled bbpress with integration settings. At the end of install I received the error Forum could not be created! I followed this advice: https://bbpress.org/forums/topic/forum-could-not-be-created and added a row to the forum table. When I try to login now I still receive the error “multiple user_login matches”
Anyone? Help? Please
!!!
February 4, 2011 at 4:40 pm #103637In reply to: Security Bug Report Contact
_ck_
ParticipantSpeaking of security, anyone using bb-attachments should please update to 0.2.8
(you’ll only need to update
bb-attachments-init.php)February 4, 2011 at 4:40 pm #98537In reply to: Security Bug Report Contact
_ck_
ParticipantSpeaking of security, anyone using bb-attachments should please update to 0.2.8
(you’ll only need to update
bb-attachments-init.php)February 4, 2011 at 3:20 pm #94911In reply to: bbPress 2.0 – Updates
Rich Pedley
MemberThe issue with using the plugin at this stage in a live environment is that at some point a reset might be needed. This would involve deleting all posts.
The plan has always been to create some way to migrate from the standalone bbPress to the plugin – but it is likely to be one of the last things coded.
February 4, 2011 at 10:34 am #104320In reply to: Plugin Help – Getting User ID
Ashish Kumar (Ashfame)
ParticipantIn your function declare
$bb_current_useras global and print_r it to see what all you can have
function blah() {
global $bb_current_user;
print_r( $bb_current_user );
}February 4, 2011 at 10:34 am #99220In reply to: Plugin Help – Getting User ID
Ashish Kumar (Ashfame)
ParticipantIn your function declare
$bb_current_useras global and print_r it to see what all you can have
function blah() {
global $bb_current_user;
print_r( $bb_current_user );
}February 4, 2011 at 6:02 am #104276In reply to: Add custom bbcode tags into BBcode lite
thebreiflabb
MemberEdit, this seems to only apply when I use override posting restrictions from the admin-can-post-anything plugin.
February 4, 2011 at 6:02 am #99176In reply to: Add custom bbcode tags into BBcode lite
thebreiflabb
MemberEdit, this seems to only apply when I use override posting restrictions from the admin-can-post-anything plugin.
February 3, 2011 at 7:31 pm #104095thebreiflabb
MemberIt works perfectly for me, though you can try with some debugging, for example try
echo $counter;inside the foreach loop to see if you have any loop at all. Check the source code if you have anything there.
February 3, 2011 at 7:31 pm #98995thebreiflabb
MemberIt works perfectly for me, though you can try with some debugging, for example try
echo $counter;inside the foreach loop to see if you have any loop at all. Check the source code if you have anything there.
February 3, 2011 at 7:25 pm #104094csabamarosi
MemberI’ve figured out that there were some PHP configuration issues with my XAMPP installation, so the error messages are gone now. Sad thing is, your code doesn’t output anything at all.
February 3, 2011 at 7:25 pm #98994csabamarosi
MemberI’ve figured out that there were some PHP configuration issues with my XAMPP installation, so the error messages are gone now. Sad thing is, your code doesn’t output anything at all.
February 3, 2011 at 6:37 pm #104091thebreiflabb
MemberIf your wordpress and bbpress share the same database you can simply edit sidebar.php
On the top of the file add:
<?php require_once(ABSPATH."/forum/bb-load.php"); ?>This will give you access to the bbpress functions. (Edit to the path of your bbpress installation)
Then where you are going to output your latest posts add this:
<?php
global $wpdb;
$query = "SELECT * FROM bbp_topics WHERE topic_status='0' ORDER BY topic_time DESC LIMIT 6";
$topics = $wpdb->get_results($query);
$counter = 0;
?>This will find the latest posts, I do it this way so it won’t show the same topic several times if many posts have been made in the same topic. Also edit bbp_ to your bbpress db prefix.
Finally to output simply add something similar to this:
<div id="latest-posts" class="border">
<h2>Latest forum posts</h2>
<?php foreach($topics as $topic) : ?>
<div class="<?php echo $counter % 2 ? "gray" : "white"; ?>"><a href="<?php topic_last_post_link($topic->topic_id); ?>"><?php topic_title($post->topic_id); ?></a></div>
<?php $counter++; ?>
<?php endforeach; ?>
</div>Edit to your preference on html and css.
February 3, 2011 at 6:37 pm #98991thebreiflabb
MemberIf your wordpress and bbpress share the same database you can simply edit sidebar.php
On the top of the file add:
<?php require_once(ABSPATH."/forum/bb-load.php"); ?>This will give you access to the bbpress functions. (Edit to the path of your bbpress installation)
Then where you are going to output your latest posts add this:
<?php
global $wpdb;
$query = "SELECT * FROM bbp_topics WHERE topic_status='0' ORDER BY topic_time DESC LIMIT 6";
$topics = $wpdb->get_results($query);
$counter = 0;
?>This will find the latest posts, I do it this way so it won’t show the same topic several times if many posts have been made in the same topic. Also edit bbp_ to your bbpress db prefix.
Finally to output simply add something similar to this:
<div id="latest-posts" class="border">
<h2>Latest forum posts</h2>
<?php foreach($topics as $topic) : ?>
<div class="<?php echo $counter % 2 ? "gray" : "white"; ?>"><a href="<?php topic_last_post_link($topic->topic_id); ?>"><?php topic_title($post->topic_id); ?></a></div>
<?php $counter++; ?>
<?php endforeach; ?>
</div>Edit to your preference on html and css.
February 3, 2011 at 6:04 pm #104275In reply to: Add custom bbcode tags into BBcode lite
thebreiflabb
MemberI made it work in a way using this:
<?php
/*
Plugin Name: BBTexCode
Description: [tex][/tex] to image
Plugin URI:
Author: Sondre Kjøniksen
Version: 1.00
*/
function bb_tex_replace( $text ) {
$text = preg_replace('/[tex](.*?)[/tex]/ie', "'<img src="/cgi-bin/mathtex.cgi?'.rawurlencode('$1').'" align="middle" />'", $text);
return $text;
}
add_filter('post_text', 'bb_tex_replace');
?>
Though I still have a problem, it seems bbpress strips backslashes when adding the post to the DB. Is it possible to do so bbpress skips stripping backslashes from [tex][/tex] tags? At the moment it works if I write double backslashes like: [tex]\LaTeX \frac12[/tex] But it is kind of annyoing having to type double every time.
February 3, 2011 at 6:04 pm #99175In reply to: Add custom bbcode tags into BBcode lite
thebreiflabb
MemberI made it work in a way using this:
<?php
/*
Plugin Name: BBTexCode
Description: [tex][/tex] to image
Plugin URI:
Author: Sondre Kjøniksen
Version: 1.00
*/
function bb_tex_replace( $text ) {
$text = preg_replace('/[tex](.*?)[/tex]/ie', "'<img src="/cgi-bin/mathtex.cgi?'.rawurlencode('$1').'" align="middle" />'", $text);
return $text;
}
add_filter('post_text', 'bb_tex_replace');
?>
Though I still have a problem, it seems bbpress strips backslashes when adding the post to the DB. Is it possible to do so bbpress skips stripping backslashes from [tex][/tex] tags? At the moment it works if I write double backslashes like: [tex]\LaTeX \frac12[/tex] But it is kind of annyoing having to type double every time.
February 3, 2011 at 5:18 pm #104090csabamarosi
MemberThere is something wrong with your site, it says fatal error so the plugin is kinda unreachable.
February 3, 2011 at 5:18 pm #98990csabamarosi
MemberThere is something wrong with your site, it says fatal error so the plugin is kinda unreachable.
-
AuthorSearch Results