I have to sort topics and replies in bbpress forum changing code how can I do it?
Hi I think i have the exact same problem.
What I notice is when a forum is embedded in another page throught either a URL or SHORTCODE.
The subscribe button simply does not work.
When I got directly at the forum, the button works.
Is it the same for you ?
Thanks. I tend to stick with the visual TinyMCE editor rather than the text editor because toggling the editors messes up my code example snippets.
This worked for me:
<center>
<img src="https://i.imgur.com/W6QaJvk.jpeg" width=216 height=298>
</center>
@2cats, just out of curiosity is it the mechanics of putting in the patch that you’re uncomfortable with. Or it it the fact that you (or your clients) would then have to deal with the patched code when updates happen.
Also I’m assuming that you’re aware of the plug-in mentioned above that fixes some of the current bbPress bugs.
Clearly the bbPress developers (who donate their time) can only do so much. But I too am curious how the priorities are set. BuddyPress recently ran a survey asking users about their priorities. I wonder if there is something like this in the works for bbPress. Sometimes I also wonder about the feasibility of a group of users with specific needs *hiring* a bbPress developer to make certain fixes and integrate them into the build. But these are just random thoughts of someone who doesn’t really know much about how these things work.
topics can be ‘sticky’ or ‘super-sticky’
sticky posts go at the top of their forum
Super sticky posts go at the top of every forum
sounds like your topics are becoming super sticky
you can look at these in then backend
dashboard>topics>edit topics and select topic > topic attributes on top right hand side> Type
they can also be set in front end
where in the topic they show in admin as
stick (to front)
if you click the ‘stick’ then it is sticky, if you click the ‘(to front)’ it becomes super-sticky which is very easy to do by mistake.
on relationships, bbpress uses wordpress ‘post-parent’
so a reply has a post parent of the topic it belongs to
a topic has a post parent of the forum it belongs to
and a forum has a post parent of a forum if it is a sub forum, or a category if it belongs to a category
These relationships are also stored in the post_meta table
details on ‘children’ are not kept – for instance displaying topics is done by a function called bbp_has_topics which selects topics where the post_parent is the forum concerned. bbp_has_relies has a similar serach for replies where the post_parent is the topic concerned.
I’m not exactly sure how to describe this problem. But I’ve seen this happen twice now. The situation is that there are several forums, and each one has a “sticky” post at the top, describing the guidelines for the particular forum.
At some point, the post at the top of one forum is duplicated on all the forums. So forums B, C, D, … all have the “forum A Guideline” post at the top of them (in addition to their own guideline post).
I’m not very good with images, but I hope this kind of shows what’s happening:
https://num9.com/wp-content/uploads/2020/08/foo.jpeg
FWIW, when I look in the database. The post in question shows its parent as the proper forum.
On a related note, I’d love to know how bbPress figures out the relationship between forums, topics, and posts. I see that each element has a pointer to its parent. But I haven’t been able to figure out where the pointers to a forum or post’s children are.
The only documentation I was able to find on the database is:
Stored Database Data
Could somebody point me to further documentation? Or let me know if I just need to read the code (specific pointers would be appreciated).
I edited the php file indicated in the trac ticket. On my setup this is:
public_html/wp-content/plugins/bbpress/includes/replies/functions.php
This is a very simple change to one line, but it does require editing the bbPress code, and (AFAIK) can’t be done in a child theme. So you would have to keep this in mind every time you update bbPress.
If you’re not familiar with doing this type of thing, then you probably want to either:
(1) Consider using by bbp-style-pack by @robin-w, which I *believe* fixes this. Robin can answer questions about that.
(2) Just wait for the bug to get fixed. I don’t really know how the priorities for bugs are set, but my impression is that this one could take a while. I might be wrong.
This is a possible fix for this:
add_filter(
‘elementor_pro/utils/get_public_post_types’,
function($post_types) {
$post_types[‘forum’] = ‘Forum’;
$post_types[‘topic’] = ‘Topic’;
$post_types[‘reply’] = ‘Reply’;
return $post_types;
}
);
Source:
https://elementor.com/blog/introducing-hello-theme/#comment-58192
Sadly this could not be the perfect solution, specially if you are using bbpress without buddypress, it seems that you could get 404 pages on user profiles.
Right now I’m trying to use a combination of bbpress + buddypress, and for me the user profile (buddypress) is working fine.
create a page and call it the same as your forum slug (usually forums)
then in that page put the message you want followed by
[bbp-forum-index]
(If you are using Gutenberg, then as this as a shortcode block)
this will then be your forums page
In any case thanks for your time!
Hope developers will fix this bug soon.
Currently, this bug can be fixed using the code below.
Also, Replies box should be moved below Custom Fields
/* Fix BBpress 2.6 bug with Custom Fields */
if( function_exists( 'bbp_get_version' ) && version_compare( bbp_get_version(), '2.5' ) > 0 ) {
add_action( 'wp_ajax_add-reply', 'wp_ajax_add_fix_bbpress_26');
function wp_ajax_add_fix_bbpress_26() {
// print_error_log( $_POST );
// $_POST['action'] = 'add-meta';
wp_ajax_add_meta();
}
add_action( 'wp_ajax_delete-reply', 'wp_ajax_delete_fix_bbpress_26');
function wp_ajax_delete_fix_bbpress_26() {
// print_error_log( $_POST );
wp_ajax_delete_meta();
}
add_action( 'add_meta_boxes', 'bbpress_26_fix_add_meta_boxes', 25 );
function bbpress_26_fix_add_meta_boxes() {
do_action( 'bbp_topic_attributes_metabox' );
}
}
Hi Robin,
thanks for the suggestion, of course I was looking at the code in the plugin before.. but it had overwhelmed me :))
so, after your tip, here is what I ended up with,
add_action ( 'bbp_template_before_single_forum', 'new_topic_button' ) ;
function new_topic_button () {
if ( bbp_current_user_can_access_create_topic_form() && !bbp_is_forum_category() ) {
$text=__('Create New Topic') ;
$href = apply_filters ('new_topic_button' , '#new-post' ) ;
echo '<a class="new_topic_button" href ="'.$href.'">'.$text.'</a>' ;
}
}
probably there is a more elegant solution.. as the button didn’t want to go to a line below the breadcrumbs.. had to use css
.new_topic_button {
background-color: #0066CC;
border: 0;
border-radius: 5px;
color: #fff;
font-size: 16px;
font-weight: 600;
padding: 15px 30px;
text-decoration: none;
width: auto;
display: block;
width: 200px;
margin-top: 30px;
}
An alternative is to use the dedicated shortcode on a page:
[bbp-topic-form]
This is the best way I have found to allow a logged in user to create a topic. Then, you just link to this page from wherever.
if you can do some basic editing and understand a bit of php, then this with some work shouldbe what you are after
add_action ( 'bbp_template_before_single_forum', 'bsp_display_buttons' ) ;
function bsp_new_topic_button () {
global $bsp_style_settings_buttons;
if (!empty ($bsp_style_settings_buttons['new_topic_description'] )) $text=$bsp_style_settings_buttons['new_topic_description'] ;
else $text=__('Create New Topic', 'bbp-style-pack') ;
if ($bsp_style_settings_buttons['button_type'] == 2) $class=$bsp_style_settings_buttons['Buttonclass'] ;
else $class='bsp_button1' ;
if ( bbp_current_user_can_access_create_topic_form() && !bbp_is_forum_category() ) {
$href = apply_filters ('bsp_new_topic_button' , '#new-post' ) ;
echo '<a class="'.$class.'" href ="'.$href.'">'.$text.'</a>' ;
}
}
function bsp_create_new_topicb () {
echo '<div><a class="bsptopic" name="bsptopic"></a></div>' ;
}
add_action( 'bbp_theme_before_topic_form', 'bsp_create_new_topicb' ) ;
sorry, that’s how it works, and how all plugins that I have known use custom fields work. As far as I can see that’s how it worked under 2.5.x – no code change I can see.
I’m just a user who helps out here, so if you really feel strongly about it, I suggest you log a bug at
https://bbpress.trac.wordpress.org/
if you update to bbp-style-pack 4.5.9 and then
Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
Code Snippets
add_action ('bsp_form_topic_login' , 'rew_redirect' ) ;
add_action ('bsp_form_reply_login' , 'rew_redirect' ) ;
function rew_redirect () {
if ( ! is_user_logged_in() ) {
echo '<ul><li><a href="http://www.mysite.com/login">Click here to log in</a></li></ul>' ;
}
}
amending the url to what you want, and amend the text as well if you want to
just did a completely new site – no plugins except bbpress and your code, twentyseventeen theme, works fine.
when you say ‘save topic as draft’ – what exactly do you mean?
GDPR does not require the user to be able to do this, merely that the site admins can do it if demanded.
I’m sure that someone could code this, but nothing I know of
Hello,
I have 0 knowledge about making website and such… but please help!
I want to make it like this –
1. Forum name clicked
2. Goes to Single Forum Layout page with corresponding forum ID (Edited with Elementor).
3. When posted Topic is clicked, It’ll show the post, reply threads and reply form.
–
I’m using Elementor’s bbpress widget and has bbp Style Pack (My WordPress theme is twenty-ninteen).
First, I made a page with Forum Index, and created a Forum. I created a Forum from WordPress dashboard “Forum”.
Second, When I click this Title of the Forum, it takes me to a WordPress Theme without “Edit with Elementor” gives me Content missing error. I’m having a trouble with this too, it seems like I have to add: the_content (); code or <?php the_content(); ?> on somewhere in the Theme Edit on dashboard. None of the Google search matched what I see on my css and php code list.
Third, I created 3 different sub-pages to Forum Index page to put in Elementor’s Bbpress widget, changed layout to Single Forum and input ID of the forum that I found from the Dashboard’s Forum section.
Problem is here, I can’t connect when the Forum name is clicked, direct to the Single Forum page.
I noticed that Breadcrumb of the Single Forum page is Home > Forums > Forum > Videos.
“Home” is Home, I don’t have a page name “Forums”-where is this coming from?
The name of the page with Bbpress widget (Forum Index) is “Forum”.
From seeing this error, It seems like I have to edit directly onto the Dashboard’s Forums section. but with these Forum page I don’t have access to Edit with Elementor.
–
I appreciate anyone’s suggestions and help! If you need any more information or need to clarify anything, please let me know.
Thank you.
the bbpress displays are built using templates.
I’d start with looking at this
bbp style pack
which will let you do many things.
to put your stats at the bottom, you’d need to look at creating a page for your forums and using
[bbp-forum-index]
then you can use gutenburg blocks or whatever editor you have to add the stats widget at the bottom
ok, I don’t think it is a css problem.
cab you tell me which method you are using in no. 8 in here
Step by step guide to setting up a bbPress forum – Part 1
Yes I did, but after running the php code snipped, the replies page is blank. Sometimes I get a Server is not available message when going to replies, but not every time.