not sure why that would be – bbp_get_forum_title just does a check and then executes get_the_title
the full function is
function bbp_get_forum_title( $forum_id = 0 ) {
$forum_id = bbp_get_forum_id( $forum_id );
$title = get_the_title( $forum_id );
return apply_filters( 'bbp_get_forum_title', $title, $forum_id );
}
It seems to work fine on my test site.
Is there a particular circumstance or is it consistently wrong on your site?
Hello,
I noticed a weird thing, the Admin profile has this empty DIV on its page:
Check it out.
Other profiles don’t have that. Check it out.
It seems to be this here:
<div class="comments-area"></div>
What is this and what is it doing there? How do I remove it? Is it some space for user comments on profiles? And why do other users don’t have that?
Thanks!
By the way I love bbpress, it’s awesome. I used a lot of other forum software (IPB, vBulletin, phpBB), but this one’s really the best!
Apologies for the delay in reporting back. I was able to modify the (style pack) latest activity widget to meet my needs. Thank you!
Along the way I found what may be a bug. On line 255, bbp_get_forum_title($forum) gets the topic title but get_the_title($forum) gets the forum title.
Okay, I GOT IT!
The key is to compare the topic id and the reply id. If they are equal, then its the first reply in bbpress.
Here is my full solution:
<?php
function add_content_before_first_reply_content($content,$id){
$post = get_post($id);
$topic_id = bbp_get_topic_id();
$reply_id = bbp_get_reply_id();
$content_to_add = '';
if ($topic_id === $reply_id) {
// do whatever you need to in here
$content .= $content_to_add;
}
return $content;
}
add_filter( 'bbp_get_reply_content', 'add_content_before_first_reply_content', 99, 2 );
Thank you Robin W. But that does not work.
$count = get_post_meta($topic_id, '_bbp_reply_count', false);
is the same as
$count = bbp_get_topic_reply_count($topic_id);
Except the second one returns a number, first one gives you an array.
The results of what you suggested gives me array([0]=>6) , meaning there are six replies to the topic.
If you do a conditional like this: if ($count === 0) { // then code } , its only going to run the code if there are no replies to the post. That’s not what I need.
ok, get the topic ID, and then in your hook to bbp_theme_before_reply_content look up whether the topic has had any replies by using
$count = get_post_meta ($topic_id, '_bbp_reply_count' , false)
If $count=0, then there have been no replies, so this is the first.
wp v5.0.1
bbpress v2.5.14
How can I hook into the FIRST reply on a single topic page? I want to add an image attachment only to the first reply, but i cannot find how to do so. I hooked into the action “bbp_theme_before_reply_content“, but it adds the image to every reply on the page!
I thought about getting a list of all reply ids, then comparing the current reply id (bbp_get_reply_id()) with the first id in the array, and showing content if they are equal. That would solve the problem. BUT I also failed at getting the list of ids – I tried with bbp_get_all_child_ids
I also wish the FIRST reply in the loop would have a unique id or class, but it does not đ
Here is the page:
Meet My New Crested Gecko
PekMez your solution does work, but still modifying the core code will be overwritten on the upcoming update, and we will probably forget about this in the future. So after upgrade our BBPress version we forget to re-modify this code.
Anyway how about now, is there a solution for BreadCrumbs without modifying the core?
Sure. I used the bbp_new_topic_pre_content Filter Hook and the code I used is as under:
//code to limit number of characters in topic contents to 500 characters
function tm_limit_topic_content( $topic_content )
{
/* Check for number of characters in topic contents */
if (strlen($topic_content) > 500) {
$revised_content = substr($topic_content, 0, 500);
}
else {
$revised_content = $topic_content ;
}
return $revised_content ;
}
add_filter( 'bbp_new_topic_pre_content', 'tm_limit_topic_content' );
I want to display only the following two on buddypress activity.
â»When creating topics for BBP.
â»When comment for topics.
What should I write in ââ»â below?
wp-content>plugins>buddypress>bp-templates>bp-legacy>buddypress>members>single>activity.php
<?php if ( bp_has_activities( bp_ajax_querystring( âactivityâ ) . â&action=â»â»â ) ) : ?>
I want to limit the number of characters in the Topic Content Text Area in bbPress to a maximum limit (of say 500 characters). How can I do it?
I tried to do it by using the maxlength attribute of textarea (bbp_topic_content) in the stylesheet file, but this attribute is not working (may perhaps be because this attribute was included in HTML5 version only). However, if I use this in Developer Tools in Chrome while inspecting the text area for Topic Content, it works fine; but that is only for testing and I am not able to make a permanent change by editing the source file or through any plugin.
Other two methods could be javascript to check on local machine the number of characters being entered, but I understand that this can easily be cheated by disabling javascript. Moreover, I am not fully sure how to do it.
Third method could be to use for action or filter hook. Can you please suggest me which hook to be used and sample code, if any?
Thanks in advance.
@robin-w , thanks for your advise. RC7 partially solved the problem.
This is before updating topic (post_id:54878) in admin area:
mysql> select * from forum_postmeta where meta_key="_bbp_subscription" ;
+---------+---------+-------------------+------------+
| meta_id | post_id | meta_key | meta_value |
+---------+---------+-------------------+------------+
.....
.....
| 35265 | 54878 | _bbp_subscription | 11743 |
+---------+---------+-------------------+------------+
This is after updating the topic (post_id:54878) in admin area:
mysql> select * from forum_postmeta where meta_key="_bbp_subscription" ;
+---------+---------+-------------------+------------+
| meta_id | post_id | meta_key | meta_value |
+---------+---------+-------------------+------------+
.....
.....
| 35265 | 54878 | _bbp_subscription | 11743 |
| 35280 | 54879 | _bbp_subscription | 1 |
+---------+---------+-------------------+------------+
So, the user subscription is there but there is a new unnecessary row, the admin user is subscribed to a non-existing topic. post_id=54879 does not exist.
Who can we report bugs?
You have been a great help.
I read through and tried https://codex.bbpress.org/bbpress-styling-crib/
What I did,
1. installed Simple Custom CSS plugin â all ok
2. insert the below code. and changed the font-size: 1.1em; to 1.6em
#bbpress-forums div.odd, #bbpress-forums ul.odd { background-color: #fbfbfb; } #bbpress-forums div.even, #bbpress-forums ul.even { background-color: #fff; }
IF post is sticky or super sticky, then
.bbp-topics-front ul.super-sticky, .bbp-topics ul.super-sticky, .bbp-topics ul.sticky, .bbp-forum-content ul.sticky { background-color: #ffffe0 !important; font-size: 1.1em; }
but the rest doesnât seem to workâŠespecially
Number 5. Various texts
bbpress-forums .bbp-topic-content p, bbpress-forums .bbp-reply-content p { font-size: 12px;
I change the font-size: 20px
nothing happens.Â
what did I do wrong? basically I wanted to increase font size for all forum section from 1 to 8. How please.
Thank you in advance
WordPress 4.9.8
bbPress 2.5.14
ProfileGrid 3.2.1
http://Www.lokmiechow.pl
Hello, i use bbpress and ProfileGrid. I have problem with profile user. Now i have 2 various profile user. 1st is from forum mybb and 2nd is from profileGrid.
1st view is, if i click on name author post. I think i need change it in file php but i dont know how and where.
1st) http://www.lokmiechow.pl/forums/user/assadsadas-asasda/
2nd) http://www.lokmiechow.pl/konto/?uid=10
I would like have only 2nd view. What should i change and where to fix it?
I would like also add options from 1st to 2nd view, for example in new overlap “user forum stats”.
When i create new topic it shows normally no issues!!
But i had a huge data that needed to be imported on the same site. I used WP All Import Plugin for the import and I imported the data into topics… Actually I only require the topics section so there is forum I want to show… I managed the look. But after the import finished. I cant see the list of topics that meant to be seen on my homepage. Though I see the topics in the sidebar under related topics. I used shortcode [bbp-topic-index] to show the topic on my homepage.
I can also see the topic in my wordpress topics section…
So, I decided to take a look in my database. I saw that earlier when i created topics it was stored in wp_posts table but now after import all that new data is in wp_pmxi_ tables and topics were in wp_pmxi_topics table. I don’t know if that supposed to be but I cant solve this issue… I even imported data again in posts which then went to wp_posts table in database but ofcourse wordpress was taking that as posts not bbpress topics…
Can please someone help me out?
if you have put the code in the plugin – that’s it !
On a load, the code looks to see if it is a topic or reply, and if so turns off pingbacks
OK I added the plug-in. Can you give some specific instructions on how to enter the code?
Do I do this for each forum page?
TNX Robin.
Peter
@robin-w how much i have to pay for that code?
<!DOCTYPE html>
<!--[if IE 7]>
<html class="ie ie7" lang="en-US" prefix="og: http://ogp.me/ns#">
<![endif]-->
<!--[if IE 8]>
<html class="ie ie8" lang="en-US" prefix="og: http://ogp.me/ns#">
<![endif]-->
<!--[if !(IE 7) | !(IE 8) ]><!-->
<html lang="en-US" prefix="og: http://ogp.me/ns#">
<!--<![endif]-->
testing some code…
edit: YEP! Code tag is working .
no.
The simplest way is to use this plugin
Code Snippets
and put the code in there
add_action( 'private_title_format', 'xbs_hide_second_prefix_title' );
function xbs_hide_second_prefix_title( $title ) {
$prefix = str_replace( '%s', '', $title );
return "<span class=\"private-title\">$prefix</span>%s";
}
and in CSS:
.private-title + .private-title {
display: none;
}
I just looked in trac, and fixing this is now a 2.8 goal.
However this looks like it might help
// Force ping_status on bbPress post types
add_filter( 'pings_open', 'rew_force_ping_status' );
function rew_force_ping_status( $open, $post_id = 0 ) {
// Get the post type of the post ID
$post_type = get_post_type( $post_id );
// Default return value is what is passed in $open
$retval = $open;
// Only force for bbPress post types
switch ( $post_type ) {
case bbp_get_forum_post_type() :
case bbp_get_topic_post_type() :
case bbp_get_reply_post_type() :
$retval = false;
break;
// Allow override of the override
return apply_filters( 'rew_force_ping_status', $retval, $open, $post_id, $post_type );
}
not within free help, sorry, but if you have a way to allocate I could probably write some code cheaply
contact me via
http://www.rewweb.co.uk
OK guys, probably not really relevant now, but I experience the same issue and found this thread.
Here is solution I use:
add_filter( 'wp_mail', function( $args = array() ) {
/**
* If WordPress wants to send an email to bbp_get_do_not_reply_address() we check
* if $search_header is set. If it is, we take its value (email address) and set
* it as "to" address. Also we unset the $search_header.
*/
$search_header = 'Bcc:';
if ( bbp_get_do_not_reply_address() === $args['to'] && is_array( $args['headers'] ) ) {
foreach ( $args['headers'] as $key => $header ) {
if ( false !== stripos( $header, $search_header ) ) {
$args['to'] = trim( str_replace( $search_header, '', $header ) );
unset( $args['headers'][ $key ] );
break;
}
}
}
return $args;
} );
The space is where the site is trying to show your avatar
<a href="http://logicbenchmarks.com/forums/users/logicbenchmarks/" title="View Admin's profile" class="bbp-author-avatar" rel="nofollow"></a>
which is somehow not showing – no idea why, but suspect you have code doing this