Ah OK – I’ve just found out that RankMath simply extracts the bbpress topic excerpt and uses that for the meta description, i.e. bbp_topic_excerpt()
Is there a way to make bbp_topic_excerpt() ignore line breaks and increase character limit?
@joel-mohanraj
find
wp-content/plugins/bbpress/templates/default/bbpress/loop-single-forum.php
transfer this to your pc and edit
so you will want to take the link out of line 34
<a class="bbp-forum-title" href="<?php bbp_forum_permalink(); ?>"><?php bbp_forum_title(); ?></a>
and save
create a directory on your theme called ‘bbpress’
ie wp-content/themes/%your-theme-name%/bbpress
where %your-theme-name% is the name of your theme
Then transfer the file you saved above and put in in the directory called bbpress that you created above, so you end up with
wp-content/themes/%your-theme-name%/bbpress/loop-single-forum.php
bbPress will now use this template instead of the original
amending the freshness will require you to amend the bbp_get_forum_freshness_link function. if you are familiar with filters you can use the filter on line 585 of \includes\forums and a str_replace to take out the link
Yes, for example, on this page https://bbpress.org/forums/ I want to remove all topics links. So it will just have a dummy # link
Hello everyone!
I’m a new user of bbpress and I’m looking for a way for logged in users to subscribe/unsubscribe to all forums by clicking a button.
I’ve managed to do it by myself, but I’d like to know if there is an easier way to do it.
Here is the code in my loop-forums.php file:
<?php
/**
* Forums Loop
*
* @package bbPress
* @subpackage Theme
*/
// Exit if accessed directly
defined('ABSPATH') || exit;
do_action('bbp_template_before_forums_loop'); ?>
<?php
$current_user = get_userdata(get_current_user_id());
if (isset($current_user) && $current_user->ID > 0) :
$user_subscribed_forum_ids = bbp_get_user_subscribed_forum_ids($current_user->ID);
$forum_ids_list = array();
while (bbp_forums()) : bbp_the_forum();
if (bbp_get_forum_type() === 'category') :
foreach (bbp_forum_get_subforums() as $subforum) :
$forum_ids_list[] = $subforum->ID;
endforeach;
else :
$forum_ids_list[] = bbp_get_forum_id();
endif;
endwhile;
$check = sizeof($forum_ids_list) === sizeof($user_subscribed_forum_ids);
$bbp_action = $check ? "bbp_unsubscribe" : 'bbp_subscribe';
$label = $check ? "Unsubscribe of all forums" : "Subscribe of all forums";
$label .= bbp_get_forum_type() === 'category' ? " of this category" : "";
if (isset($_POST) && $_POST['action']) :
foreach ($forum_ids_list as $forum_id) :
$q_args = array(
'action' => $bbp_action,
'object_id' => $forum_id,
'object_type' => 'post'
);
$permalink = bbp_get_forum_permalink($forum_id);
$wp_nonce_url = esc_url(wp_nonce_url(add_query_arg($q_args), 'toggle-subscription_' . $forum_id));
$wp_nonce_url = substr($wp_nonce_url, strlen('/'));
$url = html_entity_decode($permalink . $wp_nonce_url);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_COOKIE, LOGGED_IN_COOKIE . '=' . $_COOKIE[LOGGED_IN_COOKIE]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
curl_close($ch);
endforeach;
$user_subscribed_forum_ids = bbp_get_user_subscribed_forum_ids($current_user->ID);
$check = sizeof($forum_ids_list) === sizeof($user_subscribed_forum_ids);
$bbp_action = $check ? "bbp_unsubscribe" : 'bbp_subscribe';
$label = $check ? "Unsubscribe of all forums" : "Subscribe of all forums";
$label .= bbp_get_forum_type() === 'category' ? " of this category" : "";
endif; // isset($_POST) && $_POST['action']
endif; // isset($current_user) && $current_user->ID > 0
?>
<?php if (isset($_POST) && $_POST['action']) : ?>
<script id="prevent-form-resubmission-when-page-is-refreshed" type="text/javascript">
// source: https://stackoverflow.com/questions/6320113/how-to-prevent-form-resubmission-when-page-is-refreshed-f5-ctrlr
if (window.history.replaceState) {
window.history.replaceState(null, null, window.location.href);
document.getElementById('prevent-form-resubmission-when-page-is-refreshed').remove();
}
</script>
<?php endif; ?>
<?php if (isset($current_user) && $current_user->ID > 0 && !bbp_is_single_user()) : ?>
<form action="" method="POST">
<input type="hidden" name="action" value="<?= $bbp_action ?>">
<button type="submit" style="color: black;"><?= __($label, 'ls') ?></button>
</form>
<?php endif; ?>
<table id="forums-list-<?php bbp_forum_id(); ?>" class="table table-bordered forums-list">
<thead>
<tr>
<th class="forum-title-column">
<?php esc_html_e('Forum', 'ls'); ?>
</th>
<th class="posts-count-column">
<?php bbp_show_lead_topic() ? esc_html_e('Replies', 'ls') : esc_html_e('Posts', 'ls'); ?>
</th>
<th class="last-post-column">
<?php esc_html_e('Last Post', 'ls'); ?>
</th>
</tr>
</thead>
<tbody>
<?php while (bbp_forums()) : bbp_the_forum(); ?>
<?php bbp_get_template_part('loop', 'single-forum'); ?>
<?php endwhile; ?>
</tbody>
</table>
<?php do_action('bbp_template_after_forums_loop');
We would like to get a forum layout on our website almost exactly how the forums are laid out here on bbpress.org/forums
Does bbpress offer this? if not, how would I go about this?
Thanks!
just looked at this – sorry, as you say I don’t get to every item, and this is bespoke code which means something to someone, but without a heavy investment of time, it is hard to debug why it is not working 🙂
the function bbp_add_user_forum_subscription is still valid, and should work fine, so the actual change to the way bbpress works should not affect it.
I have little knowledge of buddypress, so I cannot say whether that code is still valid.
Have you turned debugging on ? and is it showing anything ?
this add-on plugin to bbpress does that. Whilst old, it still works
Just had a thought and dug in the code further, the duplicate check doesn’t apply to those roles/users that can ‘throttle’
// No duplicate checks for those who can throttle
if ( user_can( (int) $r['post_author'], 'throttle' ) ) {
return true;
}
bbPress User Roles and Capabilities
so default Keymaster and Moderator can post duplicates
I am not a bbpress author, just someone who helps out here.
Every website is unique, and this doesn’t happen on my test site – I have not seen this reported elsewhere as an issue, and the code has a duplicate function check in it.
line 307 of includes/replies/functions
/** Reply Duplicate *******************************************************/
if ( ! bbp_check_for_duplicate( array( 'post_type' => bbp_get_reply_post_type(), 'post_author' => $reply_author, 'post_content' => $reply_content, 'post_parent' => $topic_id, 'anonymous_data' => $anonymous_data ) ) ) {
bbp_add_error( 'bbp_reply_duplicate', __( '<strong>Error</strong>: Duplicate reply detected; it looks as though you’ve already said that.', 'bbpress' ) );
}
I am not able to say why you are getting this.
Hello Robin and thank you for your answer.
I made a test with only bbpress and twenty twenty one theme activated and the issue still occurs :
1) Create a post and double click on the “send” button
2) Your action creates 2 posts instead of one (the situation doesn’t seem handled by bbpress ?).
Please have a look at the following video :
http://www.loom.com/share/b5e083721cea47409a8c7c0ad769329f
I guess anyone can encounter this situation because no theme or function was active in my test. Shouldn’t that be handled by the core ?
Best regards
bbpress just uses wordpress registration and login, so you can use any wordpress plugin that would do that.
I googled and got this list
8 Best Age Verification Plugins for WordPress
this is the ‘tiny mce’ editor that comes bundled with WordPress which bbpress just uses.
from a quick google it doesn’t look that easy to change what is there.
ok, so
I understand from this threat that the layout of search results or topic-tag pages can be customized based on the template files stored in the bbpress/templates/default/bbpress folder.
In order to retain the customization during updates of the bbpress plugin, I have created the same folder structure inside the directory of my child theme (see screenshot).
yes that is correct and should work, BUT you would do better to only copy those templates you are changing/altering – bbpress will then use those you have changed from your child theme directory and use the unchanged from the plugin directory..
so what are users clicking to get the topic tags page ?
But now they show a warning and it has to be viewed by clicking a link.
Given that bbpress hasn’t changed, then something else is presumably now adding that warning ?
Hi there,
I understand from this threat that the layout of search results or topic-tag pages can be customized based on the template files stored in the bbpress/templates/default/bbpress folder.
In order to retain the customization during updates of the bbpress plugin, I have created the same folder structure inside the directory of my child theme (see screenshot).
The only change I’d like to make is for the topic-tag page to look exactly like the search-result page (see screenshot) –> list of forum threats in full length rather than list of titles only.
In order to realize that I need to…
1) copy a ?-search.php file from the plugin directory into the respective subfolder of the child theme and
2) rename it into a ?-topic-tag.php file.
Is this correct? If so, which ?-search and ?-topic-tag file do I need to consider?
Many thanks for your support in advance.
Best regards,
Jan
We use ‘Image Upload for BBPress’
Hello,
I looked around for a solution about this issue, but couldn’t find it.
My problem : When my users double click on “send” button, their post is sent twice.
In my opinon, preventing that double post should be included in core, but I guess it isn’t (throttling is on with 10 seconds but don’t change anything).
Do you have a suggestion or know a post that could help me here ?
Could you consider adding this feature in bbpress core ? (Who wants this issue to be possible ?)
Thank you !
bbpress just uses wordpress registration.
I suspect that emails from your site may be being seen as spam.
try the ideas in here
BBpress: Registration mails fail
If you have allowed the serach, then it should appear in your main forum list.
If it is not, it could be a theme or plugin issue
Themes
As a test switch to a default theme such as twentytwenty, and see if this fixes.
Plugins
If that doesn’t work, also deactivate all plugins apart from bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.
If you cannot do this to your site (say because it is live) then use the ‘troubleshooting’ features of this plugin to let you test without affecting other users
Health Check & Troubleshooting
Then come back
How do I create a search function for my bbPress forum?
I have enabled “Allow forum wide search” in Settings>Forums – but now I need a forum search input box.
I do have bbPress style pack which will let me change the style of it, but need the search box first.
WP version 5.8.1 (Astra theme) – bbPress 2.6.6 – site https://gillianriley.com
Thank you.
you need to be a keymaster to see forums in the dashboard – check your settings
dashboard>users
If you are not, then you need to get a keymaster to set you up.
If you are a keymaster it could be a theme or plugin issue
Themes
As a test switch to a default theme such as twentytwenty, and see if this fixes.
Plugins
If that doesn’t work, also deactivate all plugins apart from bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.
If you cannot do this to your site (say because it is live) then use the ‘troubleshooting’ features of this plugin to let you test without affecting other users
Health Check & Troubleshooting
Then come back
I am in editor mode, I have installed bbpress. I was expecting to see the forum on the sidebar. It was showing but has disappeared.
THe plugin is activated..
Yes, RankMath. Is that what’s generating the meta description? I though (perhaps naively) that bbpress did that.