Thank you for your help. Thanks to your code, I manage to set up open close button in the reply page .
So in bbp style pack or my customized code, the open close status button sets on all comments in the reply page.
It would be un-displayable by using CSS code except for top comment[topic author comment].
Do you have some sample code to hide unnecessary open close status buttons by CSS(Cascading Style Sheet) ?
Example
//topic author
<a href="http://~ #post-1762" class="bbp-reply-header">#1762</a>
class="bbp-topic-close-link"
//------------------------------------------------------------------------
//reply first
<a href="http://~ #post-1763" class="bbp-reply-header">#1763</a>
class="bbp-topic-close-link"
#bbpress-forums XXX.bbp-topic-close-link {
display: none;
}
ok so
find
wp-content/plugins/bbpress/templates/default/bbpress/loop-single-forum.php
transfer this to your pc and edit
find
<?php do_action( 'bbp_theme_before_forum_title' ); ?>
<a class="bbp-forum-title" href="<?php bbp_forum_permalink(); ?>"><?php bbp_forum_title(); ?></a>
<?php do_action( 'bbp_theme_after_forum_title' ); ?>
and replace with
<?php do_action( 'bbp_theme_before_forum_title' ); ?>
<?php if (!bbp_is_forum_category( bbp_get_forum_id())){ ?>
<a class="bbp-forum-title" href="<?php bbp_forum_permalink(); ?>"><?php bbp_forum_title(); ?></a>
<?php } else { ?>
<div class="bbp-forum-title"> <?php bbp_forum_title();?> </div>
<?php }
?>
<?php do_action( 'bbp_theme_after_forum_title' ); ?>
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
you will probably need to add some styling to the class “bbp-forum-title”
@robin-w
@karado58 – thanks for your help – this is exactly what we need 🙂
There are very few helpers here, but this is community software.
I am just a bbpress user who tries to help others as I was helped when I started, but I cannot get to every post.
Robin,
I should of used better choice of words on my post!
I apologize to you Robin and to all others here that share their precious knowledge and time unselfishly helping us newcomers to bbPress!
Thank you for your kind words, Robin, and I’m sorry!
K58
Addding close topic select box in the reply page
Only the moderate can set up open/close on topic status now.
I have plan to change the author in topic to set open/close status by yourself.
The code ongoing
function my_bbp_theme_before_topic_form_submit_wrapper() {
if (!current_user_can('moderate', $topic_id)) { // The all visitor can see open/close box
echo '<label for="bbp_topic_status">'.esc_html_e('Topic Status:', 'bbpress').'</label><br />';
bbp_form_topic_status_dropdown();
}
}
add_action('bbp_theme_before_topic_form_submit_wrapper', 'my_bbp_theme_before_topic_form_submit_wrapper');
function my_bbp_get_topic_statuses($topic_statuses, $topic_id) {
// The all visitor may be possible to chang the topic status,if the select box works.
if (!current_user_can('moderate', $topic_id)) {
$topic_statuses = array(
bbp_get_public_status_id() => _x('Open', 'Open the topic', 'bbpress'),
bbp_get_closed_status_id() => _x('Closed', 'Close the topic', 'bbpress')
);
}
return $topic_statuses;
}
add_filter('bbp_get_topic_statuses', 'my_bbp_get_topic_statuses', 10, 2);
Two questions
1st
The topic open/close select box is shown all visitor except for author.
So this code need to change all vistor to topic author.
But I don’t know.
if (!current_user_can('moderate', $topic_id)) { // All visitor can do
↓
if(current_user_can( '//topic author//' ) ) { // Only topic author can do
2nd
The select box is shown, but it doesn’t work at all.
In short, the select box is appearance only.
So I have to add some code to work open/colse select box.
The select box does not link to topic status function.
But I don’t know how to chage the code.
$topic_statuses = array(
bbp_get_public_status_id() => _x('Open', 'Open the topic', 'bbpress'),
bbp_get_closed_status_id() => _x('Closed', 'Close the topic', 'bbpress')
)
“We are happy with them having no FORUM role (only a site role) when the account is created. The problem of the being able to log them out when the account is created is not related – please note they are separate, and only one is a problem. We do not want to assign, by BBPress settings or code, any account a forum role. We only want them to earn a forum role when they log in to the site, as they do. This was specific custom code added after an earlier change, and took the devs to get it done.”
that’s great.
You might want to take a look at bbp_new_topic_handler which I took this code from and gives you checks for all the parameters.
which is in
bbpress 2.6.6\includes\topics\functions.php line 96 onwards
to see what checks bbpress does to the data before processing. This function is used by the new topic form.
the content is hooked to 4 functions, 3 of which are removed for capable uses on line 140 etc.
presuming that you are creating the content so will not be trying to break or do naugthy things, then you can probaby ignore these.
bbpress does one more it calls the function bbp_code_trick from the filter on line 173
which is this in bbpress 2.6.6\includes\common\formatting.php
function bbp_code_trick( $content = '' ) {
$content = str_replace( array( "\r\n", "\r" ), "\n", $content );
$content = preg_replace_callback( "|(<code>)(.*?)</code>|", 'bbp_encode_callback', $content );
$content = preg_replace_callback( "!(^|\n)<code>(.*?)</code>!s", 'bbp_encode_callback', $content );
return $content;
}
If you’re trying things, then I’d suggest you create some draft items in bbpress and then see what content is in the database to see what you would need to save there.
Thanks much @robin-w for updating this plugin. Installed it today at my website https://strokesupport.in and activating it leads to a fatal error on my website as under :
====
Plugin could not be activated because it triggered a fatal error.
Warning: Illegal string offset ‘display’ in /usr/local/lsws/stroke/html/wp-content/plugins/bbpress-post-topics/index.php on line 924
Fatal error: Uncaught Error: Cannot unset string offsets in /usr/local/lsws/stroke/html/wp-content/plugins/bbpress-post-topics/index.php:926 Stack trace: #0 /usr/local/lsws/stroke/html/wp-includes/class-wp-hook.php(287): bbppt_activate(”) #1 /usr/local/lsws/stroke/html/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(”, Array) #2 /usr/local/lsws/stroke/html/wp-includes/plugin.php(484): WP_Hook->do_action(Array) #3 /usr/local/lsws/stroke/html/wp-admin/plugins.php(193): do_action(‘activate_bbpres…’) #4 {main} thrown in /usr/local/lsws/stroke/html/wp-content/plugins/bbpress-post-topics/index.php on line 926
==============
All help and guidance would be appreciated. Thanks
@karado58 – thanks for your help – this is exactly what we need 🙂
There are very few helpers here, but this is community software.
I am just a bbpress user who tries to help others as I was helped when I started, but I cannot get to every post.
Newly created user accounts are automatically showing as logged in – the person used to need to actually log in before earning this “session” accreditation. Now, as soon as a script-bot has created the account, is allows you to log it off (this was a change from earlier behaviour)
hi,
how can i restrict forum access depends on registration user fields..
on registration he chose that he is a Math teacher – he could not go into English teachers forum
i’m usig bbpress (no buddy press for now..)
is saw some answer for restricting by role.. but i need by the user fields.
will really appreciate your help looking for hours and days!
Hello,
I use bbPress with LearnDash.
For LearnDash I have so called “Group Leaders” which lead their own forum as moderators.
I noticed that you can add a moderator to a specific forum on the right side within a forum. I did that by adding the username. But what is the effect of this exactly?
Somehow this user als sees Topics in the backend from all other forums. The moderator should only see topics from his forums, no?
Could you give me a hint on how to configure or implement this?
Thank you very much.
what wordpress and bbpress levels does a sample user who can do this have?
I noticed that in my BBPress users are able to edit each other’s profile. Only when we are logged out that the edit option does not appear or work. I’ve tried to disable caching, move plugins, but I don’t think that’s the problem.
Obs, use Generatepre theme
I have BuddyPress installed along with bbPress. However, when I click anything in the bbPress profile, such as topics started, replies created etc., I’m just taken either to the BuddyPress member list, or my own BuddyPress profile. Is it possible to to be able to access both profile pages, i.e. BuddyPress as well as bbPress?
ok, let us try and get to what you want.
so if the content of a reply was ‘hello how are you ?’
then at the moment bbpress would show
<div class="bbp-reply-content">
hello how are you ?
</div>
what would you like it to show?
that seems to be an error in your buddyboss theme which has amended the loop-single-reply template
loop-single-reply.php in bbpress only has 55 lines.
I would suggest you post this in the buddyboss support forums
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
Hi,
I would like create a <div> with class in <?php bbp_reply_content(); ?> in bbpress/loop-single-reply.php but I can’t find where is the function bbp_reply_content()
Not knowing php, is there someone to help me ?
Thank you very much
Dear Robin,
i have this bug there:
Notice: Undefined variable: countr in …/wp-content/themes/buddyboss-theme-child/bbpress/loop-single-reply.php on line 155
Please help.
Ok, so as a follow up, I am glad to say that I received my first (Moderation: Flagged reply) today as a post was held as pending and I was notified by email
bbPress – Moderation Tools tool still works, 😉
Hello bbPress team, I need your help please, how can I move breadcumb and subscribe button to the end of my forum page? I don’t know how to try in php
My website:
Aprende a jugar
Thanks
Greetings
Hello all,
I have already configured WordPress in French. I am using the version 5.6–fr_CA, but bbpress is not translated as mentioned here : https://codex.bbpress.org/getting-started/bbpress-in-your-language/
So I followed steps 1 and 2 indicated on the website, but the translation still doesn’t work. Do you have a solution?
I am using version 2.6.6 of bbpress. My website is the following: https://adaptationmemphre.ca
Thank you very much,
Hi,
I am the author of GD bbPress Toolbox Pro. I would advise you to post this question to the official plugin support forum: https://support.dev4press.com/forums/forum/plugins/gd-bbpress-toolbox/, WordPress official forums deal with the free plugins only (available in WordPress.org repository).
Regards,
Milan
Hello, I dont know if I’m asking in the right place.
But, I want to ask about code that has a connection with BBpress.
I want to make a button in javascript that alert reply id of the user.
This is my code:
function engagement_post($reply_id = 0){
$get_reply_id = bbp_get_reply_id($reply_id);
$get_author_id= bbp_get_reply_author_id( $get_reply_id );
echo $get_reply_id;
?>
<style>
.buttons{
background-color: #E8E8E8;
border-radius: 12px;
}
</style>
<button class="buttons" onclick ="myFunction(this)" name="button1" type="button1" style="font-size:10px">BUTTON</button>
<script>
const data =[
{id: '<?php echo $get_reply_id ?>'}
];
function myFunction(){
var id = $(data).attr("id");
alert('Button Clicked!, Reply ID:'+id);
}
</script>
<?php
}add_action('bbp_theme_after_reply_content', 'engagement_post');
I’m already tried, but not find the answer. The code seems like only alert the first topic id. I mean, after topic id, the reply still alert same id. Example: Topic ID: 474, and then the other user reply and have reply id: 475, the javascript still alert 474.
The purpose of this code, I want to make like and dislike button. So I need to make every button know what kind of reply id is it.
All answer is very appreciated. Thank You Very Much
Hello,
I inform you that I am a total beginner in php and that my English is approximate, I apologize in advance.
I would like to add a class for the “content reply” block
inside “<? php bbp_reply_content ();?>”
Indeed I installed bbPress Toolbox which is “grafted” to <? Php bbp_reply_content (); ?> for the signature but I need to access it to format the write space before signing.
I do not know if I’m clear.
thank you