Search Results for 'code'
-
Search Results
-
Topic: problem with some queries
Hi, I’ve written a custom plugin to convert my old bbcode syntax myurl to myurl>.
It worked for a large amount of posts but I still get a lot (also) of errors.
Here’s a query error :
UPDATE bb_posts SET post_text ='Bon c'est sur que si on compare :rolleyes:nn
nn
' WHERE post_id = 114958
As you see, the url tags have not been updated neither.
My function :
function replace_bbcode_urls() {
global $bbdb;
$regex=”#[url ?
[^[]*) ?] ?([^]]*) ?[/url]#”;
$sql = “SELECT post_id, post_text FROM bb_posts WHERE post_text LIKE ‘%[url=%'”;
$results = $bbdb->get_results($sql);
foreach($results as $row){
$new_monchamp = preg_replace($regex, “\2“, $row->post_text);
$sql2 = sprintf(“UPDATE bb_posts SET post_text =’%s’ WHERE post_id = “.$row->post_id, mysql_real_escape_string($new_monchamp));
if ($bbdb->query( $bbdb->prepare($sql2) )) {
//echo $row->post_id.”
“;}else {
//echo “error processing post “.$row->post_id.”
“;echo $sql2.”
“;exit;
}
}
}
Help would be appreciated.
Thanks !
I just realized today if you are using a bunch of plugins that have their options stored in the bbpress meta, your query count has jumped on every page in bbPress 1.0.x
Apparently 1.0 now has a reserved list of option names that are pre-loaded, instead of *all* of them like 0.9 could. Plugins have to add their desired names to the pre-caching option, which of course 100% of all pre-exisiting plugings are not aware of, so they all cause an extra query in 1.0
This isn’t a magic bullet by any means but you can at least fix this behavior. There isn’t any flag you can turn on to cache all (that would be far too easy) but you can fool the routine by loading all the options before it gets around to it.
Simply make the below into a mini-plugin, or right click here
and save as
_load-options.php
in yourmy-plugins/
directoryI strongly suggest you save it with a leading underscore so it auto-loads.
<?php
/*
Plugin Name: Load Options
*/
global $bbdb;
$results = $bbdb->get_results( "SELECT meta_key, meta_value FROM $bbdb->meta WHERE object_type = 'bb_option' ");
foreach ( $results as $options ) {
wp_cache_delete( $options->meta_key, 'bb_option_not_set' );
wp_cache_set( $options->meta_key, maybe_unserialize( $options->meta_value ), 'bb_option' );
}
?>Topic: date and time
Hi, I want to change the time and date format to Dutch. I saw this code for it
‘<?php topic_time(); ?>`
in post.php:
` <?php printf(__(‘Posted %s ago’,’rag’), bb_get_post_time()); ?> <a href=”<?php post_anchor_link(); ‘
So my bbpress is broken, and I don’t know how to fix it.
I built my site with wordpress in a sub directory. I integrated my bbpress with my wordpress and it worked great!
Then I decided that I wanted my URL to look like its own domain, instead of a subdomain. My wordpress went from being
brandonmdennis.com/oxhorn
to
oxhorn.com
I saved my pagelinks and presto, everything is snazzy. I went to check my forum, however, and it was broken. My forum was missing, but I still saw the admin section. So no sweat, I logged into the dashboard and proceeded to change the URL in settings from
brandonmdennis.com/oxhorn/forum
to
oxhorn.com/forum
Thinking that this would solve the issue. I clicked update, and got to an “oops! page not found” screen. But now I can’t even log into my bbpress install dashboard. Everything I do now sends me to an “oops” error page.
I tried uninstalling bbpress by removing the folder and removing the wordpress bbpress integration plugin. I tried doing a new, clean installation of bbpress, but when I get to step two I see the message “Woops! Looks like you already have bbpress installed” and it wont let me go further. I even tried installing it in a different subdirectory and got the same problem. My questions are:
1) How do I re-install bbpress?
2) Is there some code I need to remove from my wordpress installation?
3) How do I re-integrate my bbpress with wordpress so that they share the same database? I had it working splendidly until I changed my WordPress domain name.
WordPress site:
oxhorn.com
Bbpress installation:
brandonmdennis.com/oxhorn/forums
Thanks all!
Hello, i need to use current page link for some code, how to get it from bbpress?
bb_uri(); returns main page link, but i need to get link where is user now.
it’s possible?
bbpress 1.0.2
thank you
upd1: found after 1 min: <?php bb_location(); ?> don’t works (returns only current name of page, etc: topic-page, forum)