Hi Robin, thank you for replying quickly. Is there a shortcode (or even a php snippet) for adding a forum’s subscribe button to a template?
I am struggling with Search for my forum. The standard WP Search within my site works and includes results from the bbpress forums but only shows individual posts. I’d rather show links to the Topic, or at least have a link in the posts found to the topic.
So I tried to implement Search within the forum.
I tried using shortcode [bbp-search] but this changes nothing on the page. I tried the shortcode [bbp-search-form] on the page and got a search box but no matter what text I enter in there I only ever get the same single result which is the latest overall WP post, not a bbpress post.
I have set “Allow forum wide search” in settings.
What am I doing wrong?
ok, so which method atre you using in
https://codex.bbpress.org/step-by-step-guide-to-setting-up-a-bbpress-forum/ item 3
if method 1, then try using method 2
We had a PHPBB many years ago, which we migrated to bbPress around four years ago, but it seems some flags remained in the database for the whole time, flags like (_bbp_class, _bbp_old_user_id, _bbp_password, _bbp_phpbb_user_avatar, _bbp_phpbb_user_sig). They might be needed; I have no idea.
But after the last update of WP and all the plugins, all the migrated users started to get an error message instead of being able to log in:
`
{“success”:false,”data”:[{“code”:”bbp_converter_db_connection_failed”,”message”:”Database connection failed”}]}
`
After some debugging and searching, I found https://bbpress.trac.wordpress.org/ticket/3419#no0 and tried to remove _bbp_class, which helped 🙂
I just needed to wipe the SQLite Object Cache
because it kept the old data. It might happen to someone else in the future, I don’t know. I don’t know if you can somehow influence that this metadata is not stored there or something else. But at least you have the information that it might happen.
sorry I did
add_action('bbp_new_forum_form', 'add_formation_field_to_forum_form');
Well it still doesn’t work, what if instead of that, I add a select on the form to create a forum, I create it also in the admin panel. how can I do that because I did
add_action('bbp_new_forum_form_after_content', 'add_formation_field_to_forum_form');
function add_formation_field_to_forum_form() {
$formations = get_terms(array(
'taxonomy' => 'formation',
'hide_empty' => false,
));
if (!empty($formations) && !is_wp_error($formations)) {
echo '<div class="bbp-form">
<label for="forum-formation">Sélectionner une formation :</label>
<select name="forum_formation" id="forum-formation">';
foreach ($formations as $formation) {
echo '<option value="' . esc_attr($formation->term_id) . '">' . esc_html($formation->name) . '</option>';
}
echo '</select>
</div>';
}
}
I want to link the forum to the taxonomy formation I think it should be more easier but in that way it doesn’t work I have linked formation to forum by doing
function link_formation_taxonomy_to_forums() {
register_taxonomy_for_object_type('formation', 'forum');
}
add_action('init', 'link_formation_taxonomy_to_forums');
ok so from the admin area I think you need to hook to
do_action( 'bbp_forum_attributes_metabox_save', $forum_id );
I did
add_action('bbp_new_forum_post_extras', 'my_custom_bbp_new_forum_handler');
function my_custom_bbp_new_forum_handler( $action = '' ) {
error_log('test function');
if ( 'bbp-new-forum' !== $action ) {
return;
}
if ( ! bbp_verify_nonce_request( 'bbp-new-forum' ) ) {
bbp_add_error( 'bbp_new_forum_nonce', __( '<strong>ERROR</strong>: Are you sure you wanted to do that?', 'bbpress' ) );
return;
}
do_action( 'bbp_new_forum_post_extras', $forum_id );
$forum_title = get_the_title($forum_id);
$forum_slug = sanitize_title($forum_title);
if (!term_exists($forum_title, 'forums')) {
$result = wp_insert_term($forum_title, 'forums', array(
'name' => $forum_title,
'slug' => $forum_slug
));
if (is_wp_error($result)) {
error_log("Erreur lors de l'insertion du terme : " . $result->get_error_message());
} else {
error_log("Terme de taxonomie 'forums' créé avec succès : " . print_r($result, true));
}
} else {
error_log("Le terme existe déjà : " . $forum_title);
}
$redirect_url = bbp_get_forum_permalink( $forum_id );
bbp_redirect( $redirect_url );
}
but it still doesn’t work the first error log doesn’t appear on the debug file
I think you need to hook to
do_action( 'bbp_new_forum_post_extras', $forum_id );
which is in the function bbp_new_forum_handler
Hello, I have a taxonomy forums that is is linked to the user, how can I do to create a forum on bbpress and when it’s done it also create a forum on my taxonomy
my code is :
function create_forum_taxonomy_entry($forum_id, $forum_args) {
$forum_title = get_the_title($forum_id);
$forum_slug = sanitize_title($forum_title);
error_log(“Création du forum : ” . $forum_title);
error_log(“Slug du forum : ” . $forum_slug);
// Insertion du forum dans la taxonomie forum
if (!term_exists($forum_title, ‘forums’)) {
$result = wp_insert_term($forum_title, ‘forums’, array(
‘slug’ => $forum_slug
));
if (is_wp_error($result)) {
error_log(“Erreur lors de l’insertion du terme : ” . $result->get_error_message());
} else {
error_log(“Term créé avec succès : ” . print_r($result, true));
}
} else {
error_log(“Le terme existe déjà : ” . $forum_title);
}
}
add_action(‘bbp_insert_forum’, ‘create_forum_taxonomy_entry’, 10, 2); but this function isn’t called
the file has another function below and it works so it’s not the calling of the file
This is not bbPress related. This is error in Avada theme, most likely due to outdated code that is not updated for PHP 8.x. This message is related to changes in PHP 8.1. You need to update Avada, or contact Avada author to fix the problem.
Is there an action I can use to execute PHP code before every bbPress page loads?
Then maybe I can try altering cookies to make bbPress switch languages.
I want language selection to be dynamic and user controlled.
Hello, George.
First of all, thanks for sharing that code modifications, it seems to fix the pagination for forums set up inside BuddyPress groups without any problem.
While following your instructions, I have a problem with the pagination between replies and I would like to ask you. For testing purposes, I have set a maximum of 2 replies per page for each topic. When I create a first reply, it is displayed without problem as topic content, but when I create a second reply, it is not displayed and a new page is not created for pagination. However, when I create a third reply, a new page is created showing the second reply and the third reply.
I think the problem could be with the initial content that is indicated when creating a topic. As you know, when you create a new topic you are asked for a title for that topic as well as some content as an introduction. When you enter the topic, this ‘introduction’ is displayed in the replies section but is not counted as a reply. So having set a maximum of 2 replies per page for each topic for testing, the first page shows the ‘introduction’ and replay 1, but when creating replay 2, as the same page is showing the ‘introduction’, this new reply is not shown and a second page is not created either as it detects only 1 replay on the first page.
How could this be solved? On the other hand, the pagination between topics works very well.
Thank you very much in advance, best regards.
If you look on the linked page and see a big white block, the oEmbed on my site isn’t working (when someone makes a post in bbPress, it automatically embeds it as shown on the page, but the link doesn’t work). Everything looks right, but the link doesn’t work. I can’t figure out what I can do to fix it or disable it. I’ve turned to a friend who knows how to code (I don’t) and she said that her bbPress installation has the same issue.
Here’s a page with an example:
Kirk Hunter Farewell Sale
Thanks for your help.
Hi Robin,
Thank you for replying.
I did find something that was said years ago about not putting the topic title into the reply record, not sure why.
So I create a record in the meta table, which is a custom field in the reply form using the following code and add the topic title as a custom field to the custom message in the Fs Poster plugin I am using to post to social media.
function check_and_populate_top_title_on_edit() {
global $pagenow;
// Check if we are in the post.php page (edit post/reply screen) and in the admin area.
if ($pagenow === 'post.php' && is_admin()) {
// Get the post ID from the URL query string.
$post_id = isset($_GET['post']) ? intval($_GET['post']) : 0;
// If we have a valid post ID, proceed.
if ($post_id) {
$post = get_post($post_id);
// Ensure we're working with a 'reply' post type.
if ($post && $post->post_type === 'reply') {
// Check if the post title is empty.
if (empty($post->post_title)) {
// Get the parent post ID.
$parent_post_id = $post->post_parent;
// Check if a parent post exists.
if ($parent_post_id) {
// Get the parent post data.
$parent_post = get_post($parent_post_id);
// If the parent post exists and has a title, update the 'top_title' custom field.
if ($parent_post && !empty($parent_post->post_title)) {
// Add or update the 'top_title' meta field with the parent post's title.
update_post_meta($post_id, 'top_title', $parent_post->post_title);
}
}
}
}
}
}
}
add_action('load-post.php', 'check_and_populate_top_title_on_edit');
sorry, been working on another project.
If you fill in the title in the admin of a reply, as far as I know it will cause no issues, I’ve not seen any code that uses this field. I cannot be absolute, but best I can say.
basic economics –
You using bbpress generates no income for anyone.
bbpress is a wordpress product, so someone has to sponsor a coder to code stuff, ie someone has to pay for this, and unless there is a reason for this, it doesn’t happen.
Take a look at the below link as this works for a logged in user. The three shortcodes should help achieve what you are looking for.
bbp topic count
I don’t have BuddyBoss installed. bbPress provides integration code that injects the “Forum” tab inside the group creation process. Normally:
add_filter( 'groups_create_group_steps', function ( $steps ) {
unset( $steps['forum'] );
return $steps;
} );
or something of that sort would have solved the issue. I was wondering of bbPress injects the tab in a different way.
I would appreciate if you could forward that to one of the devs, since you are a Mod, Robin, otherwise, thanks for the help.
But the integration code resides inside bbPress
– not sure what you mean – the filters you quote are all buddypress or possibly buddyboss
But the integration code resides inside bbPress. If it was core BuddyPress filters, it would be much simpler, don’t you think?
I want to remove the “Forum” step from the BuddyPress group creation step but keep the group forums active. I have tried many solutions but I can’t seem to find a filter I could use.
For example, this code:
add_filter( 'groups_create_group_steps', function ( $steps ) {
unset( $steps['group-settings'] );
return $steps;
} );
removes the group settings from the group creation process.
This code:
function buddydev_remove_group_admin_settings() {
if ( ! bp_is_group() ) {
return;
}
bp_core_remove_subnav_item( groups_get_current_group()->slug . '_manage', 'group-settings', 'groups' );
// reattach screen function to avoid 404.
add_action( 'bp_screens', 'groups_screen_group_admin', 3 );
}
add_action( 'bp_template_redirect', 'buddydev_remove_group_admin_settings', 1 );
removes the group settings from the Group “Manage” menu.
Using this:
function remove_unwanted_group_creation_steps() {
global $bp;
if ( isset( $bp->groups->group_creation_steps['forum'] ) ) {
unset( $bp->groups->group_creation_steps['forum'] );
}
}
add_action( 'bp_before_create_group_content_template', 'remove_unwanted_group_creation_steps', 9999 );
removes the step but leaves the /create/step/forum/
step active, thus messing with the custom number of steps I have.
Can you please help?
Hello,
So I am trying to add Topics Counts and Reply counts in a widget box on activity page or member profiles – I’ve tried BBP Style Pack and the shortcodes don’t work.
Any suggestions?
Thanks for reply but, sorry…
Installed and keymaster issue (so, nothing work, I need to fix via your plugin): this is an important issue (cannot work without the fix by your plugin).
Also, not work in FSE and also with your plugin I have bad result.
FSE is out and default theme in wp from about 4 yrs and still not supported from bbpress.
This really looks like an abandoned project.
Other minor project (like asgaros
And similar) work out of the box (install, shortcode, all work as expected).
Best regards and I really hope bbpress team can work to fix asap this issue.
I tried to reinstall bbPress after a long time, but encountered several issues.
First, there was no keymaster role after installation, which made the plugin unusable. I had to fix it via the BBP Style Pack plugin using the keymaster fix. It seems strange that I need one plugin just to make another work.
After that, I faced a blank page issue. Even though the BBP Style Pack plugin helped fix this as well, I still encountered problems—such as the shortcode in the footer not being parsed and some graphical glitches.
It seems impossible now to simply install bbPress, add a shortcode to a page, and use it like I did years ago.
I’m really disappointed with the current state of the plugin. It feels like it has been abandoned.