Search Results for 'bbpress'
-
AuthorSearch Results
-
April 5, 2015 at 6:52 am #160797
In reply to: SMF Import to bbPress
curvemeister
ParticipantHi again,
Here is an improved version of the SMF to bbPress script. This version supports additional, non-image filetypes, and has more safeguards against inserting attachments multiple times if the script is interrupted and restarted. Since I am not yet savvy in the ways of submitting source code to the forum, I am cutting and pasting, which seems to butcher the syntax horribly…
Many thanks, again, to Stephen.
================================================================
<?php
//Standalone script to import smf attachments for the GD bbPress Attachments plugin
//Mike Russell, April 4, 2015
//Execute after you have imported smf into bbPress.
//Run this from the command line, not the web (it will timeout)require( ‘wp-load.php’ );
require( ‘wp-admin/includes/image.php’ );
global $wpdb;$verbose = false;
$force_attachment_update = false; //normally false. set true to re-write existing attachments
//$limit = ” LIMIT 0,1″;
$limit = ” LIMIT 0,99999″;// source database connection
$host=”localhost”;
$uname=”xxx”;
$pass=”xxx”;
$database = “xxx”;
$site_url = ‘http://www.xxx.com/forum’;
$forum_path = ‘forum/attachments/’;echo “start smf_attachments-to-bbpress v1.2\n”; flush();
//get the attachment rows from SMF
$smf_db = new wpdb($uname, $pass, $database, $host);
$smf_rows = $smf_db->get_results(”
SELECT * FROM smf_attachments
WHERE file_hash != ”
AND filename NOT LIKE ‘%thumb’
ORDER BY id_attach”
.$limit);echo “processing “.$smf_db->num_rows.” rows total\n”;
// process each row
$count = 0;
foreach ($smf_rows as $smf_attachment_row) {
if($verbose) { echo ‘next row, id_attach = ‘.$smf_attachment_row->id_attach.”\n”; flush(); }//look for both a new and old style filename to copy. If neither exists, skip this attachment
$smf_filename = $forum_path.$smf_attachment_row->id_attach.’_’.$smf_attachment_row->file_hash;
if(!file_exists($smf_filename))
$smf_filename = $forum_path.$smf_attachment_row->id_attach.’_’.$smf_attachment_row->filename.$smf_attachment_row->file_hash;if(!file_exists($smf_filename))
{
echo “no file, skipping attachment for SMF attachment “.$smf_attachment_row->id_attach.”, missing SMF file: “.$smf_filename.”\n”; flush();
continue;
}$uploads = wp_upload_dir(‘SMF’);
$new_upload_dir = $uploads[‘path’];
$new_full_filename = $new_upload_dir.’/’.$smf_attachment_row->filename;
if($verbose) { echo(‘old->new = ‘.$smf_filename.’ -> ‘.$new_full_filename.”\n”); flush(); }//copy the enclosed file from SMF to the upload dir if necessary
if(!file_exists($new_full_filename) && !copy($smf_filename, $new_full_filename) ) {
echo “cannot copy: “.$smf_filename.”->”.$new_full_filename.”\n”;
} else {
//look for a reference to the bbPress-imported parent post for the current attachment
$parent_args = array(
‘post_type’ => array(‘topic’, ‘reply’),
‘meta_key’ => ‘_bbp_post_id’,
‘meta_value’ => $smf_attachment_row->id_msg
);
//echo “$parent_args = “.print_r($parent_args).”\n”;$parent_query = new WP_Query($parent_args);
$parent_query->get_posts();
if($verbose || $parent_query->post_count > 1) {
echo $parent_query->post_count.” posts found for smf_post id “.$smf_attachment_row->id_msg.”\n”; flush();
}//add the attachment if there is exactly one parent referencing it
if($parent_query->have_posts() && $parent_query->post_count == 1) {
$guid = $uploads[‘url’] . ‘/’ . basename( $new_full_filename );
$parent_query->the_post();
$post_id = get_the_ID();//if force option is not specified, skip updating an already existing attachment
if(!$force_attachment_update) {
$q = $wpdb->prepare(
”
SELECT COUNT(*)
FROM $wpdb->posts
WHERE guid = %s AND post_parent = %d
“,
$guid,
$post_id);$nrefs = $wpdb->get_var($q);
if($nrefs > 0) {
if($verbose) { echo “skip existing attachment: “.$guid.”\n”; flush(); }
wp_reset_postdata(); //reset post info
goto done;
}
}$attachment_data = array(
‘guid’ => $guid,
‘post_mime_type’ => ‘image/’.$smf_attachment_row->fileext,
‘post_title’ => $smf_attachment_row->filename,
‘post_status’ => null,
‘post_content’ => ”,
);
if($verbose) { echo “attachment_data = “.print_r($attachment_data).”\n”; flush(); }$attach_id = wp_insert_attachment($attachment_data, $new_full_filename, $post_id);
//echo “attach_id = “.$attach_id.”\n”; flush();
if($attach_id) {
//update_post_meta($attach_id, ‘_bbp_attachment’, 1);
if($attach_metadata = wp_generate_attachment_metadata($attach_id, $new_full_filename)) {
//echo ‘attach_metadata = ‘.print_r($attach_metadata).”\n”; flush();
wp_update_attachment_metadata( $attach_id, $attach_metadata );
set_post_thumbnail( $post_id, $attach_id );
} else {
echo ‘wp_generate_attachment_metadata failed, fname = ‘.$new_full_filename.”\n”; flush();
}
}
wp_reset_postdata();
}
}
done:
$count++;
if($count%100 == 0)
{
echo $count.” attachments processed\r”;
flush();
}
}
echo “Done, processed “.$count.” records\n\n”;//clean up message body text
//convert <tt> -> <br />
mysql_query(“UPDATE wp_posts SET post_content = REPLACE (post_content, \'<tt>\’, \'<br />\’) WHERE post_content LIKE \’%<tt>%\'”);mysql_close($connection);
exit;
?>April 5, 2015 at 4:53 am #160790Robin W
ModeratorI presume you want rid of the one to the left of search ?
that should be in
bbpress/templates/default/bbopress/content-archive-forum.php line 24 in 2.5.5
April 4, 2015 at 10:14 pm #160786In reply to: Changing Hyperlink Colors
Robkk
ModeratorI did open Filezilla and I searched for “cache” — I found a cache.php file, but I didn’t even attempt to go mucking about in there!
yep , dont edit files or delete any files you might cause another issue with your site.
I’m a little glad to hear that you’ve possibly had a similar problem; maybe I can ask some other people on the site to try out different browsers and see if I need to go clean out my CPU cache.
something like it , im sure its common too , like i said i dont remember 100%
If you have a chance to add more classes to the CSS code, I would be extremely grateful. I really appreciate the time and effort you’ve spent on my issues.
i tested with your theme and this seemed to work.
.bbpress span#favorite-toggle a, .bbpress span#subscription-toggle a { color: #000; } .bbpress span#favorite-toggle a:hover, .bbpress span#subscription-toggle a:hover { color: #707070; }April 4, 2015 at 8:53 pm #160781In reply to: Make the forum pages full-width
Robkk
Moderatoralright since i think your site has jetpack installed
make sure you have the custom css module activated in jetpack .
now go to appearance > edit css
copy this code into your custom css editor.
.bbpress .post-section { margin: 0 2% 20px 2%; width: 96%; } .bbpress #content-main { width: 100%; margin-right: 0; }hit save
check and see if it works
if the code does work, reply back on here that it works now.
if the code doesnt work i need to see if any Custom CSS on bbPress would show . so copy and replace my old CSS code that you just previously pasted
with this code
.bbpress a { color: red; }now see if your links on your forum are red
if it turns red, reply back here that your links are red and that i need to add more classes to your original CSS so i could make your forum full width.
April 4, 2015 at 8:12 pm #160778In reply to: Forum page title links to last forum created – why?
mel77
ParticipantHi Robin, thanks for your help.
It turned out to be a theme issue. I managed to fix it by using the 2nd option in part 3 of your guide “Creating a forum page”: https://codex.bbpress.org/step-by-step-guide-to-setting-up-a-bbpress-forum/
April 4, 2015 at 7:44 pm #160776Jake Hall
ParticipantHi Rob,
Can’t show a live link since it is not currently live.
Here’s how it looks:

Essentially, can you see the breadcrumb inside its own content box? that’s what I have added manually. That is where I want my breadcrumb, it looks much better separate from the forum content.
However, the breadcrumb then also appears within the forum root / home page.
I was able to edit this out in every other page via the user of template files found in /bbpress/templates/bbpress and /extras, however, I have been unable to spot a template which I can edit for the forum root page.
Every other page is working flawlessly. Just this one page.
April 4, 2015 at 6:09 pm #160769In reply to: Make the forum pages full-width
Robkk
ModeratorThese two Custom CSS rules should help.
put them anywhere you can put custom CSS
child themes style.css file
jetpacks custom CSS module
a standalone custom css plugin..bbpress .post-section { margin: 0 2% 20px 2%; width: 96%; } .bbpress #content-main { width: 100%; margin-right: 0; }if this does not work try this CSS for a test
if the links in your forum turn red the CSS is working.
.bbpress a { color: red; }if the links are red and my above CSS rules for full width arent working i probably have to redo the CSS rules i gave you above to include more div classes which will be super annoying.
April 4, 2015 at 6:01 pm #160768Robin W
ModeratorYou are not understanding the problem.
spot on !
the code you gave is an action, so would not contain the breadcrumb unless some other code outside bbpress is actioning it.
can you give us a link/url to a page and tell us what you want moved/added/changed
April 4, 2015 at 5:21 pm #160764In reply to: Changing Hyperlink Colors
Robkk
ModeratorI’m still working on how to disable caching for logged in users.
what cache plugin are you using??
Is there a way to make it so that the Favorite and Subscribe buttons aren’t blue too?
here i think i copied how the sidebar links are shown.
.bbpress a.favorite-toggle, .bbpress a.subscription-toggle { color: #000; } .bbpress a.favorite-toggle:hover, .bbpress a.subscription-toggle:hover { color: #707070; }April 4, 2015 at 4:55 pm #160761In reply to: Make the forum pages full-width
Robkk
ModeratorSlightly NSFW
i laughed at this.
@davidnsfw add !important after 96% like this.bbpress #content-main { width: 96% !important; }and see if that works.
April 4, 2015 at 4:35 pm #160758In reply to: Make the forum pages full-width
Robin W
Moderatortry adding
.bbpress #content-main {
width: 96%;
}to your style.css
April 4, 2015 at 4:15 pm #160753Robin W
Moderatorbit of a difference between
and wanted it removed completely
and
I merely want to move it.
🙂
but it doesn’t seem as if that’s possible.
um, yes it is, you just hadn’t asked !
just use
<?php bbp_breadcrumb(); ?>
in the code
there are many template files that use this
just look in
templates\default\bbpress\
and you’ll find all the templates
tell us where you want it, and we’ll try to help further
April 4, 2015 at 4:04 pm #160748In reply to: Setup problems
April 4, 2015 at 3:11 pm #160744In reply to: Changing Hyperlink Colors
DanaJoy2008
ParticipantI’m so sorry — I thought you might want me to make a new topic here on this bbPress support site. I would have happily made a new post on my own website!
I think this is what you need, but if not, please do let me know.
April 4, 2015 at 2:19 pm #160738In reply to: Hierarchical Forum and Category Layout
Robkk
Moderatorcopy the loop-forums.php file into your child theme in a folder called bbpress
https://github.com/robkk/bbPress-Hierarchical-Forum-and-Category-Layout
also i need to move this file to a gist….it seems more appropriate over there
April 4, 2015 at 2:04 pm #160733In reply to: Make the forum pages full-width
Robin W
Moderatoryes take out the line
<?php get_sidebar(); ?>about 5 line sup from the bottom.
BUT you need this to be a bbpress.php file in the right directory as per and don’t delete the page.php file – that runs the rest of your site !
April 4, 2015 at 2:04 pm #160732In reply to: Can I do this?
April 4, 2015 at 1:56 pm #160728In reply to: Changing Hyperlink Colors
Robkk
Moderatorif this isn’t possible, I totally understand.
no its possible , i forgot some periods though.
Here should be the full code , not shortened though.
#bbpress-forums div.bbp-topic-content a, #bbpress-forums div.bbp-reply-content a { color: blue; text-decoration: underline; }if it still doesnt work , post a topic that has a couple links in the replies and topic post and i can find some CSS that would work with your theme.
April 4, 2015 at 1:55 pm #160727In reply to: Setup problems
Robin W
Moderatorok,
It could be a theme or plugin issue
Plugins
Deactivate all but bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.
Themes
If plugins don’t pinpoint the problem, as a test switch to a default theme such as twentytwelve, and see if this fixes.
Then come back
April 4, 2015 at 1:13 pm #160713In reply to: Forum page title links to last forum created – why?
Robin W
ModeratorApril 4, 2015 at 1:11 pm #160712Robin W
ModeratorAny replies with silly css hacks will be ignored
not sure that attacking potential helpers is the best way to get a response. Using hide in css is a perfectly acceptable way of achieving things even if you think it silly. I prefer non css solutions purely because my css is rubbish 🙂
Anyway in the documentation you will find
enjoy !
April 4, 2015 at 1:04 pm #160709In reply to: Full Width Problem with page.php
Robin W
ModeratorI think your theme is causing this. Unfortunately many theme authors wrap the various sidebar options into one page.php file nowadays. It gives theme flexibility, but doesn’t help andyone with custom post types such as bbpress. I’ve taken a look and try amending the bbpress.php to
<?php global $is_tf_blog_page,$post; $id_post = $post->ID; if(tfuse_options('blog_page') != 0 && $id_post == tfuse_options('blog_page')) $is_tf_blog_page = true; get_header(); if ($is_tf_blog_page) die(); ?> <?php $sidebar_position = tfuse_sidebar_position(); ?> <?php tfuse_shortcode_content('before');?> <div class="main-row content-row"> <div class="container"> <div class="middle-main content-full"> <div id="primary" class="content-area"> <div class="inner"> <article class="post post-details"> <?php if(!tfuse_page_options('hide_title')):?> <header class="entry-header"> <h1 class="entry-title"><?php echo get_the_title();?></h1> </header> <?php endif;?> <div class="entry-content"> <?php while ( have_posts() ) : the_post();?> <?php the_content(); ?> <?php break; endwhile; // end of the loop. ?> </div> </article> <?php if ( comments_open() ) : ?> <?php tfuse_comments(); ?> <?php endif;?> </div> </div> </div> </div> <?php tfuse_shortcode_content('after'); ?> <?php get_footer();?>which takes out all the stuff relating to sidebars.
Come back if that doesn’t work or errors
April 4, 2015 at 11:47 am #160705In reply to: How to: registration and login
Robin W
Moderatorgood set of questions!
bbpress uses WordPress registration for forum users, so they will integrate nicely.
There are widgets within bboress that allow for login and registration
With forums set to public, then anyone can see forums, but only logged in users can ‘participate’
Users can change their email in the profile section
two queries
5. Once registered, every time the user visits again login will be required to participate in the forums.
This will be the case, unless they use the remember me function, but in effect that is the same as it is a logged in person. There are plugins to prevent remember me if you want to disable eg
https://wordpress.org/plugins/remember-me-controls/7. The user will have to be allowed to unsubscribe.
They cannot delete themselves, they can just stop using. They can of course send the admin a request to be deleted, and then the admin has the choice of deleting all content for that user, assigning it to someone else, or just blocking that user so that the content remains under their name.
April 4, 2015 at 11:33 am #160702In reply to: Can I do this?
Robin W
Moderator@ebunny3k maybe fair comment, but not sure why you’re lurking on here if you feel that bbpress is such a bad product 🙂
April 4, 2015 at 11:10 am #160700In reply to: Hierarchical Forum and Category Layout
ebunny3k
ParticipantIs it really hard to add this categories thing to core code? So anyone can use them without any hassle? And yes it is so nice to point out some nice websites where people rewrite bbpress code to make it usable. <- But it does not help other 99% users.
-
AuthorSearch Results
