I got a error after putting this code. But that error helped me to find out the code where I needed to change. Thanks very much 🙂 I appreciate 🙂
try adding this to your functions file
add_filter('bbp_has_replies_query', 'modify_replies_query');
function modify_replies_query($bbp_r) {
$bbp_r = 'ASC';
return $bbp_r;
}
Functions files and child themes – explained !
I’ve been working hard at setting up a site for my podcast and things had been going swimmingly, but while looking around at some RSS feed import widgets and such today, somehow I seem to no longer have working BBpress forums. It doesn’t seem like it would be related, but who knows?
The forums still show in my dashboard, and I was able to create a forum page by hand and get it to show the index with shortcode, but when I click on any of the forum links, it gives me a page not found error. It seems to do so even if I swap to one of the bundled 201x themes.
The RSS widget I was testing out is RSS Multi Import 3.15 and I’m running WordPress 4.2.2 with the Generate Press theme 1.2.9.8 and BBpress 2.5.7. Website is http://www.whitebookpodcast.com.
I’m a quite a newb to delving in to WordPress stuff, so I have to admit that I’m at a loss. Any thoughts on possibilities?
That’s why I installed it.. Testing the code and by the time my forum is done bbPress 2.6 will be released I hope.
But still, a missing core stylesheet?
Some developer who has worked last on the code should’ve mentioned it don’t you think, maybe the developers have some fancy tool where they test/fork the alpha and beta versions with?
I just downloaded the latest version (trunk) of the trac website.
https://bbpress.trac.wordpress.org/browser/trunk ( bottom – download .zip )
Hi,
Lots of plugins make this message appear :
Notice: bbp_setup_current_user was called incorrectly. The current user is being initialized without using $wp->init(). Please see Debugging in WordPress for more information. (This message was added in version 2.3.) in /srv/wp-includes/functions.php on line 3560
How could we correct this, it’s very annoying because even my functions (not related to bbpress) causes this !
For example, this code display bbpress error :
if (!current_user_can('update_plugins')) {
add_action('admin_init', create_function(false,"remove_action('admin_notices', 'update_nag', 3);"));
}
In fact, I prefered to do iy myself. It’s not specific to bbpress and I’m very surprised that WP doesn’t have this feature natively.
For the ones who nedd this, here is my simple code :
function yournamespace_exclude_menu_items( $items, $menu, $args ) {
// only hide items in front, not admin
if ( !is_admin() ) {
// Iterate over the items
foreach ( $items as $key => $item ) {
// hide menu items which leads to pages with 'private' status
if ( !is_user_logged_in() && get_post_status($item->object_id) == 'private' ) unset( $items[$key] );
}
return $items;
}
else return $items;
}
add_filter( 'wp_get_nav_menu_items', 'yournamespace_exclude_menu_items', null, 3 );
it’s an alpha version – this is unreleased code, so you would expect stuff to be wrong/missing.
Hi Everyone,
Please, i want to make my wordpress site a forum website. so, have decided to use bbpress.
And i want my forum to look exactly like this forum (styling and everything)
So, have decided to use a template file.
So, can somebody help me with the php code and css code to make my forum look exactly like this one.
Thanks in anticipation.
yes, it is only already declared because I used the same function name.
Just combine the two and you get
//This function changes the text wherever it is quoted
function change_translate_text( $translated_text ) {
if ( $translated_text == '%s ago') {
$translated_text = '%s';
}
if ( $translated_text == 'This forum contains %1$s and %2$s, and was last updated by %3$s %4$s.' ) {
$translated_text = 'This elephant contains %1$s and %2$s, and was last giraffed by %3$s %4$s.';
}
if ( $translated_text == 'This forum contains %1$s, and was last updated by %2$s %3$s.' ) {
$translated_text = 'This elephant contains %1$s, and was last giraffed by %2$s %3$s.';
}
if ( $translated_text == 'This forum contains %1$s and %2$s.' ) {
$translated_text = 'This elephant contains %1$s and %2$s.';
}
if ( $translated_text == 'This forum contains %1$s.' ) {
$translated_text = 'This elephant contains %1$s.';
}
return $translated_text;
}
add_filter( 'gettext', 'change_translate_text', 20 );
Well…I’ve run into a problem. I have this code that removed the word “ago” from the freshness layout:
function change_translate_text( $translated_text ) {
if ( $translated_text == '%s ago') {
$translated_text = '%s';
}
return $translated_text;
}
add_filter( 'gettext', 'change_translate_text', 20 );
The only place I want to include the word “ago” is on the top of the forum within the forum data block. Right now it reads: This forum contains x topics, and x replies, and was last updated by x 4 minutes.
When I use the code above and manually add the word ago at the end of the line, I get an error because it was already declared. Is there a way around this? Thank you.
You can add the following code in your functions.php file:
add_action(‘media_buttons’, ‘ml_pre_media_buttons’, 1);
add_action(‘media_buttons’, ‘ml_post_media_buttons’, 20);
function ml_pre_media_buttons($editor_id) {
if (!$editor_id == ‘bbp_reply_content’)
return;
$GLOBALS[‘post_temp’] = $GLOBALS[‘post’];
$GLOBALS[‘post’] = null;
}
function ml_post_media_buttons($editor_id) {
if (!$editor_id == ‘bbp_reply_content’)
return;
$GLOBALS[‘post’] = $GLOBALS[‘post_temp’];
}
it’s in
/includes/forums/template.php
lines
1987, 1995, 2007, 2017
You could probably filter it by
//This function changes the text wherever it is quoted
function change_translate_text( $translated_text ) {
if ( $translated_text == 'This forum contains %1$s and %2$s, and was last updated by %3$s %4$s.' ) {
$translated_text = 'This elephant contains %1$s and %2$s, and was last giraffed by %3$s %4$s.';
}
if ( $translated_text == 'This forum contains %1$s, and was last updated by %2$s %3$s.' ) {
$translated_text = 'This elephant contains %1$s, and was last giraffed by %2$s %3$s.';
}
if ( $translated_text == 'This forum contains %1$s and %2$s.' ) {
$translated_text = 'This elephant contains %1$s and %2$s.';
}
if ( $translated_text == 'This forum contains %1$s.' ) {
$translated_text = 'This elephant contains %1$s.';
}
return $translated_text;
}
add_filter( 'gettext', 'change_translate_text', 20 );
in your functions file
Functions files and child themes – explained !
I believe the following in your functions file should work
function no_edit_lock($retval, $cur_time, $lock_time, $post_date_gmt){
return false;
}
add_filter( ‘bbp_past_edit_lock’, ‘no_edit_lock’, 1, 4);
Functions files and child themes – explained !
Please come back and tell us if it does !
Does this go into the theme style.css the bbpress.ccs style? And do I just copy and paste said code?
thanks for your help! Your codex worked for me and has now given me the basis to style the page a bit more.
Thanks a lot
@Robkk
I didn’t minify the code and I think there is no ajax comments
@dc4x_admin
I found something awhile ago , sorry I forgot about this topic.
i cannont seem to find the code i used though.
But you can just use this plugin instead , it should do the same thing.
https://wordpress.org/plugins/bbpress-popular-topics/
The shortcode is something like this for that plugin.
[bbpresspopulartopics qty = 5]
bbPress is inheriting some CSS from your theme that is suppose to be for the WordPress comments.
try this custom CSS to fix the issue
#bbpress-forums .reply {
margin: 0px;
}
i found it somewhere on the web that users cannot use iframe code because wordpress prohibits it for the sake of security. -it says that – if they r allowed to use iframe codes, they might be able to attack you –
@pinkishhue: I’m using Weaver Xtreme Theme.
@Robkk: The custom titles in AIO SEO are all set to %page_title% | %blog_title%
There are none of the forum related options you said to check. (Maybe in pro version)
The forum is displayed via shortcode on a standard page.
When I remove the forum shortcode the title is displayed correctly. Adding the forum to the page removes the title.
did you add the iframe code into ‘text editor’?
it won’t work if you put it into ‘visual’ tab
I’ve been using bbpress plugin to set up forums for my website’s users. Originally there is no function when it comes to ‘counting views’ of each post. So I added some codes according to this website’s advice.
It works fine with general(sitewide) forums but when I made a group(buddypress function) and tried to integrate it with bbpress forum, the view count php code does not work in group forums. (Still, it works perfectly fine at sitewide forums)
this is my code right now (wp-content/plugins/bbpress/templates/default/bbpress/loop-single-topic.php)
<li class="bbp-topic-voice-count">
<?php
if( !function_exists('get_wpbbp_post_view') ) :
// get bbpress topic view counter
function get_wpbbp_post_view($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
return "0";
}
return $count;
}
function set_wpbbp_post_view($postID) {
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if( $count == '' ){
add_post_meta($postID, $count_key, '1');
} else {
$new_count = $count + 1;
update_post_meta($postID, $count_key, $new_count);
}
}
endif;
if( !function_exists('add_wpbbp_topic_counter') ) :
// init the view counter in bbpress single topic
function add_wpbbp_topic_counter() {
global $wp_query;
$bbp = bbpress();
$active_topic = $bbp->current_topic_id;
set_wpbbp_post_view( $active_topic );
}
add_action('bbp_template_after_single_topic', 'add_wpbbp_topic_counter');
endif;
echo get_wpbbp_post_view( bbp_get_topic_id() ); ?>
</li>