Hello,
I am considering bbPress. I would like to migrate posts from an old style mailing list into a modern forum.
Is there a current way of doing this?
If not, I may write a Java application for this purpose. Is it practical then to access the bbPress database directly for the Java code in order to insert posts? I’d like to retain the original timestamps. I’d also need to create users, associated with the email addresses of the posters.
Regards,
Rupert
Anonymous UserInactive
You can use bbp_get_reply_content filter, but this can be a disaster when you take off all the links that other plugins or the theme could have in the reply content. A good example is the mentions being added by BuddyPress, but after using this, they turn into the restriction notice..
add_filter('bbp_get_reply_content', 'restricted_links', 20, 2);
function restricted_links($content, $post_id) {
if ( is_user_logged_in() )
return $content;
return preg_replace_callback( '/<a(.*?)href(.*?)>(.*?)<\/a>/si', function($m){
return sprintf(
'<span class="protected-link" style="background:#f3f3f3;padding: 2px 5px;display:inline-block;border-radius:3px">[Restricted Link] Please <a href="%s">register</a> to view this link</span>',
home_url('/wp-login.php?action=register')
);
}, $content );
}
You may pass-in the link text after the notice or something, it is all up to you so play around with the code or ping me if you needed help.
Hi folks,
i added the following code to a php file in the /mu-plugins/ folder, to deactivate a plugin for logged-in users:
add_filter( 'option_active_plugins', 'disable_logged_in_plugin' );
function disable_logged_in_plugin( $plugins ) {
require (ABSPATH . WPINC . '/pluggable.php');
if ( is_user_logged_in() & !is_admin() ) {
$key = array_search( 'bloom/bloom.php' , $plugins );
if ( false !== $key ) {
unset( $plugins[ $key ] );
}
}
return $plugins;
}
Strangely bbPress gets also deactivated by it, while all other plugins run without any problem.
Do you have an idea why this happens and what to change?
Regards
Dominik
Not totally sure what you are trying to achieve as I’ve not used this plugin but in
wp-content/themes/flex-mag/style.css
line 3779 has
#comments {
display: none;
float: left;
font-size: 0.8rem;
line-height: 120%;
margin-top: 30px;
overflow: hidden;
width: 100%;
}
try setting display to visible
you could do this by adding
#comments {
display: visible !important;
}
to the custom css tag in my style pack plugin that you have loaded
I am trying to replace my comments on posts with bbpress topics. This plugin is working for the most part…I’m able to auto create new topics of my published posts on the forum. However, my comment box has disappeared on the posts. There is a comment button to click. But when clicked, there is nothing displayed for posting comments.
I have found out that this is a theme issue and not a plugin issue. When I change to a different theme, such as a WordPress default theme, the plugin works. However, I do not want to lose my current theme. Does anyone know if there is any css code I can add to my theme in order to make the bbpress comment box to appear on the WordPress posts.
Website: http://bamadigest.com
Thank you!
looks fine to me – all quite readable, but it is your site so your call!
play with the following numbers
so overall you might try
/* Change margin */
@media only screen and (max-width: 499px) {
/* Change the width of the author column */
#bbpress-forums div.bbp-forum-author, #bbpress-forums div.bbp-topic-author, #bbpress-forums div.bbp-reply-author {
width: 50px;
}
/* position the left hand side of the content column */
#bbpress-forums div.bbp-reply-content {
margin-left: 70px;
}
/* hide the avatar */
a.bbp-author-avatar {
display: none;
}
}
yes put this in your functions file – untested but should work
add_filter ('bbp_before_get_search_terms_parse_args', 'pluus_amend_search') ;
function pluus_amend_search ($args) {
$args['post_type'] = bbp_get_topic_post_type() ;
return $args ;
}
Hmph… okay… I’ve noticed that /plugins/bbpress/includes/search/template.php is actually responsible for that feature:
function bbp_has_search_results( $args = '' ) {
global $wp_rewrite;
/** Defaults **************************************************************/
$default_post_type = array( bbp_get_forum_post_type(), bbp_get_topic_post_type(), bbp_get_reply_post_type() );
// Default query args
$default = array(
'post_type' => $default_post_type, // Forums, topics, and replies
'posts_per_page' => bbp_get_replies_per_page(), // This many
'paged' => bbp_get_paged(), // On this page
'orderby' => 'date', // Sorted by date
'order' => 'DESC', // Most recent first
'ignore_sticky_posts' => true, // Stickies not supported
's' => bbp_get_search_terms(), // This is a search
);
So, changing ‘post_type’ => $default_post_type to ‘post_type’ => bbp_get_topic_post_type() works. However, it’s not clearly the best practice to modify the plugin directly anyother way to override this?
Hi bb Team,
I found a bug, maybe, on bbpress ver.: 2.5.12 if I use action bbp_author_metabox
I try to add some user info on metabox but if I call this:
add_action('bbp_author_metabox', array($this, 'bbp_author_details'));
function bbp_author_details($post_id) {
echo "<p>Test</p>";
}
in html code I’ve this on start tag:
`<p>Test</p><!DOCTYPE html>
<!–[if IE 8]>`
and on the right place:
<div id="bbp_author_metabox" class="postbox " >
<button type="button" class="handlediv button-link" aria-expanded="true"><span class="screen-reader-text">Commuta il pannello: Informazioni autore</span><span class="toggle-indicator" aria-hidden="true"></span></button><h2 class='hndle'><span>Informazioni autore</span></h2>
<div class="inside">
<p>
<strong class="label">ID:</strong>
<label class="screen-reader-text" for="bbp_author_id">ID</label>
<input type="text" id="bbp_author_id" name="post_author_override" value="xxxxx" data-ajax-url="xxxx" />
</p>
<p>
<strong class="label">IP:</strong>
<label class="screen-reader-text" for="bbp_author_ip_address">Indirizzo IP</label>
<input type="text" id="bbp_author_ip_address" name="bbp_author_ip_address" value="xxxxxx" disabled="disabled" />
</p>
<p>Test</p></div>
</div>
I found that do_action( ‘bbp_author_metabox’, get_the_ID() ) it’s called twice:
-on author_metabox function (bbpress/includes/admin/topics.php)
-on bbp_author_metabox function (bbpress/includes/admin/metaboxes.php)
-on author_metabox function (bbpress/includes/admin/replies.php)
This cause html error code.
I think it’s name error on bbpress/includes/admin/topics.php and should be do_action( ‘bbp_author_attributes_metabox’, get_the_ID() );
Thank you
David
You may try https://imgcave.com all image types are accepted. It generates numerous codes to easily link to images.
Hey guys,
I get a 500 error after the latest update:
AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: [] operator not supported for strings in /var/www/vhosts/<url>/wp-content/plugins/bbpress/includes/forums/functions.php:1800
Stack trace:
#0 /var/www/vhosts/<url>/wp-includes/class-wp-hook.php(298): bbp_pre_get_posts_normalize_forum_visibility(Object(WP_Query))
#1 /var/www/vhosts/<url>/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters('', Array)
#2 /var/www/vhosts/<url>/wp-includes/plugin.php(515): WP_Hook->do_action(Array)
#3 /var/www/vhosts/<url>/wp-includes/class-wp-query.php(1681): do_action_ref_array('pre_get_posts', Array)
#4 /var/www/vhosts/<url>/wp-includes/class-wp-query.php(3238): WP_Query->get_posts()
#5 /var/www/vhosts<url>/wp-includes/class-wp.php(617): WP_Query->query(Array)
#6 /var/www/vhosts/<url>/wp-includes/clas...'
ln 1800 looks like this:
$post_stati = $posts_query->get( 'post_status' );
// Default to public status
if ( empty( $post_stati ) ) {
$post_stati[] = bbp_get_public_status_id();
// Split the status string
} elseif ( is_string( $post_stati ) ) {
$post_stati = explode( ',', $post_stati );
}
could be fixed by forcing the array:
$post_stati = $posts_query->get( 'post_status' );
if (!is_array($post_stati)){
$post_stati = array($post_stati);
}
// Default to public status
if ( empty( $post_stati ) ) {
$post_stati[] = bbp_get_public_status_id();
// Split the status string
} elseif ( is_string( $post_stati ) ) {
$post_stati = explode( ',', $post_stati );
}
side note: wp version 4.7.4, bbpress version 2.5.12
Thanks in advance,
Toby
When I say single forum/topic/reply slug I actually meant for the single post-type slugs of forum/topic/reply. As the /forums/ slug is just a wrapper for all those bbPress custom post-types. So you could effectively remove the /forums/ wrapper and end up with just http://wwww.somesite.com/forum/name-of-specific-forum/. If you rename the single /forum/ slug to /forums/ it would become http://wwww.somesite.com/forums/name-of-specific-forum/ or something similar with topics like http://wwww.somesite.com/topics/name-of-specific-topic/
And adding the topic slug after the forum slug is not intuitive as the topics don’t actually exist inside the forums, they are simply linked to it–similar to a shortcut. This is something that can be done with breadcrumbs, however.
Again, permalinks can be rather tricky. In fact I’m fairly certain they’re the reason the “Private” forums are leading not-logged in visitors to a 404 page. I’d try putting everything back to the default settings and seeing if that fixes the error. Also, look at any customizing, plugins you might have that could interfere with bbPress defaults.
BTW, bbPress has a default error message for not-authorized users and “private” forums that should display. Again, something must be off in the settings/configuration.
My forum has no “private” forums, so I have little experience with this particular issue. Sorry.
Best of luck,
Chad
Hi @chadschulz
When I’m not logged in, the forum link goes to an error page. I’ve set forum visibility to “Private” because I only want course members for a specific online course I host on my site to have access to the forum. So the “private” issue doesn’t show up when not logged in because nothing shows up.
Here, take a look: https://satdecoded.com/forums/forum/support-clinic/
It leads to an error page (which I don’t know why it does) when not logged in. Any way to NOT make it lead to error page, but a custom page that just says you must be a course member to see the private forum?
I’m confused what you mean by renaming the slug for the single forum/topic/reply. I see the settings for single forum, but what I’d really like is this:
http://www.somesite.com/forums/name-of-specific-forum/some-topic/
I plan to have different forums for different online classes. Thanks!
yes there is, but basically it needs you to know what your page template is called
see
Step by step guide to setting up a bbPress forum – Part 1
item 8 for some more details
I am a newbie with WordPress and I have been using a custom menu widget placed at the top of all of my pages to keep a consistent header going. I am now trying to use bbPress and discovered I can create a page called “Forum” and use a page builder to place my menu widget above the forum shortcode widget to achieve the header.
However, when I select a forum/topic, it goes to a different page, one that is generated by bbPress and as such, doesn’t have a page builder design of which I can place a header.
It seems like the best solution would be to implement this header into all my pages through editing some php file somewhere but that is a bit beyond my technical ability. Is there a way to add widgets to ALL bbpress pages?
Hi. I tried the following code, created a new user, logged in as that user, went to subscriptions, and the user was not subscribed to any forums.
Was hoping the new user would be subscribed to the single forum that exists.
Help appreciated.
Regards,
Steve
add_filter( 'bbp_get_user_subscribe_link', 'invert_get_user_subscribe_link', 10, 4 ); //invert forum subscription
add_filter( 'bbp_is_user_subscribed_to_forum', 'invert_is_user_subscribed_to_forum', 10, 4 ); //invert forum subscription
add_filter( 'bbp_get_forum_subscribers', 'invert_get_forum_subscribers' ); //invert forum subscription
add_filter( 'bbp_is_user_subscribed', 'invert_is_user_subscribed', 10, 4 ); //invert forum subscription
function invert_is_user_subscribed($retval, $user_id, $object_id, $subscribed_ids) {
if (get_post_type( $object_id ) == bbp_get_forum_post_type())
return !$retval;
else
return $retval;
}
function strContains($needle, $haystack) {
if (strpos($haystack, $needle) !== false) {
return true;
} else {
return false;
}
}
function invert_get_user_subscribe_link ($html, $r, $user_id, $topic_id) {
if (strContains( "bbp_unsubscribe", $html )) {
$html = str_replace("bbp_unsubscribe", "bbp_subscribe", $html);
} else {
$html = str_replace("bbp_subscribe", "bbp_unsubscribe", $html);
}
return $html;
}
function invert_get_forum_subscribers( $users ) {
$args = array('fields' => 'id');
$all_users = get_users($args);
$send_to_users = array_diff($all_users, $users);
return $send_to_users;
}
function invert_is_user_subscribed_to_forum( $retval, $user_id, $forum_id, $subscribed_ids ) {
return !$retval;
}
I understand why you might want to change the permalinks to “clean” your url. However, this helps distinguish forums from topics from replys. For example somesite.com/forums/forum/some-forum or somesite.com/forums/topic/some-topic.
You can remove the “forums” part of the permalink in admin settings under forum and Forum Root Slug–Forum Prefix select off. And you can rename the slug for single forum/topic/reply under same menu and Single Forum Slugs. These built-in adjustments are usually harmless and can be changed as needed.
There are also a few bbPress/WordPress permalink plugins that might help–but they could also make things worse.
Above all, you want a clean url that both makes sense and remains functional. And I’ve found that messing around too much with permalink settings can often break more than fix.
And regarding that “Private” issue: Does it display that when you’re not logged in? That’s a curious quirk.
Chad
Hi Robin,
thank you for your reply.
I have tried with
function tinymce_remove_root_block_tag( $init ) {
$init['forced_root_block'] = false;
return $init;
}
add_filter( 'tiny_mce_before_init', 'tinymce_remove_root_block_tag' );
function bbp_enable_visual_editor( $args = array() ) {
$args['tinymce'] = true;
$args['quicktags'] = false;
return $args;
}
add_filter( 'bbp_before_get_the_content_parse_args', 'bbp_enable_visual_editor' );
or with
function tinymce_remove_root_block_tag( $init ) {
$init['forced_root_block'] = false;
return $init;
}
add_filter( 'tiny_mce_before_init', 'tinymce_remove_root_block_tag' );
function bbp_enable_visual_editor( $args = array() ) {
$args['tinymce'] = true;
$args['quicktags'] = false;
$args['forced_root_block'] = false;
return $args;
}
add_filter( 'bbp_before_get_the_content_parse_args', 'bbp_enable_visual_editor' );
but I’m still getting a new paragraph for each new line.
not my field of expertise, but suggest you have the wp code,
and try
function bbp_enable_visual_editor( $args = array() ) {
$args['tinymce'] = true;
$args['quicktags'] = false;
return $args;
}
add_filter( 'bbp_before_get_the_content_parse_args', 'bbp_enable_visual_editor' );
this just does the ‘turn on’ earlier
may work, may not !!
Hi,
I have followed this documentation page
Enable Visual Editor
to enable TinyMCE. Now I would like to change the default behavior of TinyMCE to not add a paragraph for each new line but use instead <br>.
For WordPress I have to use this
function tinymce_remove_root_block_tag( $init ) {
$init['forced_root_block'] = false;
return $init;
}
add_filter( 'tiny_mce_before_init', 'tinymce_remove_root_block_tag' );
But the TinyMCE in bbPress doesn’t get this setting.
I have tried to do something like
function bbp_enable_visual_editor( $args = array() ) {
$args['tinymce'] = true;
$args['quicktags'] = false;
$args['forced_root_block'] = false;
return $args;
}
add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );
but it doesn’t work.
How can I pass that “forced_root_block” to the TinyMCE enabled for bbPress?
Thanks
Massimo
Hi there,
I have enabled forums on my site, but it seems like my forum URL is here:
http://www.satdecoded.com/forums/forum/support-clinic/
It’s set to private, so you may not be able to see it, but I’ve taken screenshots below.
The Forum Root (which is being used as a prefix slug for all forum related content) is “forums.” I’ve checked yes to the show prefix option.
Then in the single forum settings, I see that the it shows “forum” (singular, not “forums”).
Here is a screenshot of my settings: http://prntscr.com/f7m2ca
The forum I created is called “Support Clinic.” It shows up at a URL that says “/forums/forum/ support-clinic/” Here’s a screenshot of my URL: http://ibb.co/iKJrvk
How can I get rid of the “forum” in the middle? I just want it to say “/forums/support-clinic/”
I’ve also set my forum to “Private” (I was logged in as admin when I took the screenshot), so now that gets doubled too: “Private: Private: Support Clinic”
I only want it to say “Private” once. How can I do that?
Thank you!
Thanks, Robin, that’s helpful.
In my case I wanted to remove that title and was able to do so with
#bbpress-forums > h3 {
display: none;
}
But that feels like a workaround and it was a long hunt to find this bit of the UI in what I would think of as core code. I’ll make my suggestion in the trac.
and if you want to suggest code changes, then this is the place
https://bbpress.trac.wordpress.org/
I am just a humble user, so can’t comment on changing core code, but is it is styling capability you want you could filter the actual title eg
add_filter( 'bbp_get_forum_title', 'rew_title');
function rew_title () {
$title = '<span class="rew">.$title.'</span>' ;
return $title ;
}
This is both feedback and a request.
I’m working on simplifying the UI of a Commmons In A Box site, which means I’m working with both BuddyPress and bbPress. While working on the group/forum page, I found that the forum title is hard coded as a simple h3 with no selectors into wp-content/plugins/bbpress/includes/extend/buddypress/groups.php at line 767. This is just before the content-single-forum template call.
My request is that the forum title be moved from groups.php and into content-single-forum.php where it can be customized through the normal child theme process. Let me know if there is a better place than here to file this as an issue.
Thanks!