I installed WordPress as an add-on to my webpage with Aabaco Small Business (formerly Yahoo), so I don’t have folders downloaded on my computer to access code. I want to make a couple of changes to the “Reply To” form in my forums. One box asks for “Mail” and I’d like to change that to “Email” to make it more understandable. I’d also like to eliminate the box for “Website” if possible since it wont be applicable to the people who will be responding on my forum.
I’m not all that experienced with coding, but I have done a little of it on my website and I’m good at following directions! Is it possible to make these changes since I don’t have WordPress as a stand alone?
@nicolasmahy
Yeah the responsive styles in bbPress use .bbp-body which is having the issue here. But since you customized and removed the labels in the header of the forums you can try this custom CSS and see if it helps any.
@media screen and (max-device-width: 480px) {
#bbpress-forums div.bbp-forum-content,
#bbpress-forums div.bbp-topic-content,
#bbpress-forums div.bbp-reply-content {
margin-left: 0px;
padding: 12px;
}
#bbpress-forums div.bbp-forum-author,
#bbpress-forums div.bbp-topic-author,
#bbpress-forums div.bbp-reply-author {
float: none;
text-align: center;
width: 100%;
}
#bbpress-forums div.bbp-forum-author a.bbp-author-name,
#bbpress-forums div.bbp-topic-author a.bbp-author-name,
#bbpress-forums div.bbp-reply-author a.bbp-author-name {
margin: 0;
word-break: break-word;
display: block;
}
}
Hi,
What bbPress forum did you create ? So if you edit your forum /wp-admin/edit.php?post_type=forum is the ‘visibility’ under ‘Forum Attributes’ set correctly ? Try to switch it if needed with an ‘update’ in between.
Pascal.
Hi, I’m sorry but I have no idea what you try to do, but as you talk about forums and subforums without forums, you might mean that you want an extra level ?
Maybe you look for Categories > Forums > Subforums ?
Then look at https://codex.bbpress.org/getting-started/configuring-bbpress/creating-content/#creating-a%c2%a0forum
If not, just come back and explain again.
Pascal.
I’m running a WordPress Multisite install and have bbPress setup on the main site. However, logged-in users can’t access the main forum. Admins and guests can see them, which doesn’t seem to make sense. Users can see group forums, but not the main page, they just get a page not found error. I’ve even tried creating the forums page and adding the shortcodes, but still get the same error.
New users are supposed to have the participant roll, which I’ve checked. I’ve also tried repairing the forums, but nothing works.
Hi anyone and everyone,
Im just wondering why bbpress displays participants real name instead of their username by default? I want to change this as I can’t remember ever seeing a site before where you create a username for it not to be used, even this bbpress support forum shows usernames!
I see topics on this matter going back 4+ years, and still its the same solution, why?
So why is it that we have to edit code to achieve this? It should at least be a simple edit in the admin area.
Hello, I’m looking for a way to hide something that will be with the <?php bbp_forum_freshness_link(); ?>. Whenever there’s a topic for the forum, <?php bbp_forum_freshness_link(); ?> will display a link. If there’s no topic in the forum or it’s empty, then there will be no link. How do I add the same function to some custom added codes.
Examples, I’m looking for something like this:
<?php don’t display if there’s no topic or it’s empty ?>
topic title
by author
<?php bbp_forum_freshness_link(); ?>
<?php endif;?>
How can I edit this code
<?php if ( bbp_has_forums() ) : ?>
<?php bbp_get_template_part( 'loop', 'forums' ); ?>
<?php else : ?>
<?php bbp_get_template_part( 'feedback', 'no-forums' ); ?>
<?php endif; ?>
I will put forums on all forum pages, because in the subforum I have not any forums.
You can also use this PHP function to add a class to the forum instead of doing it manually.
function rkk_add_forum_classes( $classes ) {
$classes[] = 'class';
return $classes;
}
add_filter( 'bbp_get_forum_class','rkk_add_forum_classes' );
Now I would like to change while loop_forums in index forums on loop-forums.php
I do not know exactly what you are trying to do, but for just customizing it you can put the loop-forums.php file in a child theme in a folder called bbpress and then customize the file to your liking.
https://codex.wordpress.org/Child_Themes
@selenii
- Are you using the plugin bbPress moderation?? This plugin has a feature to confirm each topic or reply submitted by users.
- Do you have anything in your comment blacklist in Settings > Discussion?? bbPress uses this comment blacklist for its topics and replies and this could mark the posts as pending until approval.
Sometimes plugins can add words to this comment blacklist, and sometimes a host can install a plugin that may have its own comment blacklist words that you may not be aware of is installed because it may be installed in the root of your site.
Do these posts you are approving have any foul language?? Because that is usually the words in these comment blacklists.
Unfortunately that didn’t work. I switched the code and while it still included a sidebar with stuff, it was a sidebar with all sorts of crazy stuff about a page long.
So, I acted as if I was starting over and I copied my page.php file and resaved it as bbpress.php in my main theme folder. The result of this was a page with no sidebar anywhere in my forum since this template does not include any sidebar info.
So do I:
a) keep the page.php file that I renamed to bbpress.php and just add some code (I would need directions) to include the sidebar on all bbpress pages.
b) revert back to my previous page an keep troubleshooting this issue with the page template that i know works aside from the topics page.
Here is the code from the page.php page that I renamed to bbpress.php, which looks great but does not display my sidebar on any forum page.
<?php get_header(); ?>
<?php
// check for WooCommerce. If true, load WooCommerce custom layout
if (class_exists('woocommerce') && ((is_woocommerce() == "true") || (is_checkout() == "true") || (is_cart() == "true") || (is_account_page() == "true") )){ ?>
</div><!-- header-area -->
</div><!-- end rays -->
</div><!-- end header-holder -->
</div><!-- end header -->
<?php truethemes_before_main_hook(); //action hook ?>
<div id="main" class="tt-woocommerce">
<?php get_template_part('theme-template-part-tools-woocommerce','childtheme'); ?>
<div class="main-holder">
<div id="content">
<?php if(have_posts()) : while(have_posts()) : the_post(); the_content(); truethemes_link_pages(); endwhile; endif;
comments_template('/page-comments.php', true); ?>
</div><!-- end content -->
<div id="sidebar" class="right_sidebar">
<?php
if ( (is_cart() == "true") || (is_checkout() == "true") ) {
dynamic_sidebar("WooCommerce - Cart + Checkout");
} else {
dynamic_sidebar("WooCommerce Sidebar");
}
?>
</div><!-- end sidebar -->
</div><!-- end main-holder -->
</div><!-- main-area -->
<?php // ELSE load default layout
} else { ?>
</div><!-- header-area -->
</div><!-- end rays -->
</div><!-- end header-holder -->
</div><!-- end header -->
<?php truethemes_before_main_hook();// action hook, see truethemes_framework/global/hooks.php ?>
<div id="main">
<?php get_template_part('theme-template-part-tools','childtheme'); ?>
<div class="main-holder">
<div id="content" class="content_full_width">
<?php if(have_posts()) : while(have_posts()) : the_post(); the_content(); truethemes_link_pages(); endwhile; endif;
comments_template('/page-comments.php', true);
get_template_part('theme-template-part-inline-editing','childtheme'); ?>
</div><!-- end content -->
</div><!-- end main-holder -->
</div><!-- main-area -->
<?php // END WooCommerce loop
} ?>
<?php get_footer(); ?>
Thanks!
Ok, so the code above is from your page.php file saved as bbpress.php in your theme – yes?
NO, and that may be the issue? What I did is copy one of my other theme pages that I know included a sidebar, let’s just call it “page-with-leftsidebar.php”. I copied this page into my child folder and renamed it bbPress.php and that’s the code I posted above.
I can gladly try your suggestion above, but could it be that I used the wrong page to create my bbPress.php file? I did install the “What The File” plugin and when I look at what page my forum points to, including new topics, they all show bbpress.php as the main page with other things listed in the Template Parts section.
Anyhow…let me try your suggestion above with that piece of code and report back before i have you on an wild goose chase for no reason.
Thanks!!! Will report back shortly.
The “blank space” where it goes is still there, it just does not display.
Great – that was the bit of information I was after.
Ok, so the code above is from your page.php file saved as bbpress.php in your theme – yes?
If so then try changing
<?php generated_dynamic_sidebar(); ?>
to
<?php get_sidebar(); ?>
This may not work, I’m just guessing at how your theme is designed !
Robin (thanks for always coming to my rescue),
Everything on the page is good except the sidebar is missing. I can add it via dashboard if I edit the topic, but I cannot do this every time someone posts a new topic. All other pages have the sidebar.
I tried to move my bbpress.php to the main theme directory to ensure that it was picking up this page before any other page and that changed nothing. I then thought maybe there was code in my page.php file from the initial load of bbpress that it might be looking for so I copied the page.php file from my theme and resaved it as bbpress.php and still no difference.
I don’t really care that my forum is exactly like the layout of my other site pages so I am ok with some variation. My only requirements would be that (1) I can keep the header menu for navigation back to my main site and (2) I have the sidebar on any bbpress forum pages, specifically new topics in this situation.
Forgive me for rambling, just trying to offer what I have tried and as well my flexibility.
Would it be better for me to just make a new page template and tell it to pull in the sidebar on all pages versus using a template from the theme that included a sidebar?
I am open to suggestions, but might need to be spoon fed a little to ensure I am following all of the appropriate steps.
Many thanks!
Hi,
Sure there is: https://codex.bbpress.org/features/reply-threading/
Please note the bottom 2 small ‘issues’.
Pascal.
Thank you !
I found the file in part !!
Now I would like to change while loop_forums in index forums on loop-forums.php
exemple : http://gauge.wpengine.com/forums/
i does not use shortcode I create a forum page and i edit the default page in bbpress folder on my folder template !
translated by google !!
Thanks – yes – stupid error. It is always amazing what a fresh eye brings.
Things started working then and I checked all my numerous trace actions and it is now working well. Here is the final version for your interest.
thanks a million, Tony
// (2) When a new forum is created, all current users are automatically subscribed to it
// Note status of forum entry at start of any update
function ovni_pre_post_update_status($forum_id){
if (bbp_is_forum($forum_id)) {
global $ovni_forum_old_status;
$ovni_forum_old_status = bbp_get_forum_visibility($forum_id);
}
}
add_action('pre_post_update', 'ovni_pre_post_update_status');
function ovni_subscribe_users_to_new_forum($forum_id){ // subscribe all users to a new forum unless it is a group forum
if (bbp_is_forum($forum_id)){
if (bbp_get_forum_parent_id( $forum_id ) == 969) return; // if this is group forum, do nothing
global $ovni_forum_old_status;
if (in_array($ovni_forum_old_status, array(NULL, 'auto-draft', 'draft'))){
// forum has just been published
$all_user_ids = get_users();
foreach ($all_user_ids as $this_user){
bbp_add_user_forum_subscription($this_user->id, $forum_id);
}
}
}
}
add_action('bbp_forum_attributes_metabox_save', 'ovni_subscribe_users_to_new_forum');
Thanks @fterra for your suggestions.
I cannot see that my action on pre_post_update is firing at all, even if I edit an existing forum. I have trace actions in and neither user 33 or 32 are getting subscribed.
Puzzled.
function ovni_pre_post_update_status($forum_id){
bbp_add_user_forum_subscription(33, $forum_id); // debug **********
if (bbp_is_forum($forum_id)) {
global $ovni_forum_old_status;
bbp_add_user_forum_subscription(31, $forum_id); // debug **********
$ovni_forum_old_status = bbp_get_forum_visibility($forum_id);
}
}
add_action('pre_post_update', 'ovni_pre-post_update_status');
This would be more appropriate:
function my_pre_post_update_hook($post_ID) {
if (bbp_is_forum($post_ID)) {
global $my_forum_old_status;
$my_forum_old_status = bbp_get_forum_visibility($post_ID);
}
}
add_action( 'pre_post_update', 'my_pre_post_update_hook' );
This is funny.
I found out that pre_post_update hook – which at first sight seemed to fire only when updating – will fire if the post (or forum) has already been auto-saved AS A DRAFT.
Similarly I have also been surprised that “save_post_{$post->post_type}” third parameter $update will always be true after it’s first auto-saved AS A DRAFT.
So to know if it’s a new forum (or post), I guess you have to check its previous status. For new posts the previous status will be either ‘auto-draft’, ‘draft’ or I guess it’s also possible there will be no previous status yet.
So you can do something like hook to pre_post_update and store its current (which soon in the same request will become “previous”) status. Like this:
function my_pre_post_update_hook($post_ID) {
global $my_forum_old_status;
$my_forum_old_status = bbp_get_forum_visibility($post_ID);
}
add_action( 'pre_post_update', 'my_pre_post_update_hook', 10 );
So in your bbp_forum_attributes_metabox_save action you can check if it’s a new forum with something like:
global $my_forum_old_status;
if (in_array($my_forum_old_status, array(NULL, 'auto-draft', 'draft')))
Warning – this condition is enough because when bbp_forum_attributes_metabox_save action is fired we know the forum’s current status will not be any of these.
I guess you could also do it with the transition_post_status hook, whose arguments are: $new_status, $old_status, $post.
Hi @blandow,
Styling can be done in a lot of ways. You can play yourself with some CSS starting from https://codex.bbpress.org/layout-and-functionality-examples-you-can-use/
Or you can check plugins. bbP style pack might be able to help you for the background.
Pascal.
@fterra – thanks for your suggestions.
I have it working using ‘bbp_forum_attributes_metabox_save’ as you suggested but have found, perhaps not surprisingly, my function is fired on an update to the meta date. So with the code below I create a new forum and all users are subscribe; some choose to unsubscribe; I update something in the meta data and everyone is subscribed again – not good. Any idea how I can determine whether this is a first time save or an update?
Also I do not want to auto subscribe to group forums. I have fixed this by hard-coding in the group forum’s id, but maybe there is a better way of testing whether a forum_id is a group forum?
Any ideas welcome thanks.
function ovni_subscribe_users_to_new_forum($forum_id){ // subscribe all users to a new forum unless it is a group forum
if (bbp_get_forum_parent_id( $forum_id ) == 969) return; // if this is group forum, do nothing
$all_user_ids = get_users();
foreach ($all_user_ids as $this_user){
bbp_add_user_forum_subscription($this_user->id, $forum_id);
}
}
add_action('bbp_forum_attributes_metabox_save', 'ovni_subscribe_users_to_new_forum');
@casiepa
Do you think i should just gather any info i can and assign to the trac ticket?
The solution posted a bit further up the thread by @_az_ does the basics of removing the forum slug but as he mentioend there are a few places where the permalinks are claled like breadcrumbs etc
From what i can find out (i am not a programmer but am trying) for a quick fix we would need to get the forum parent id from the post itself then get the slug for that forumid and any parents it has. then the post permalink is built from the parent slug and the post slug.
This needs to hook into the permalink function to override this and there is a good example (for a different purpose) here https://github.com/korobochkin/bbpress-permalinks-with-id which i think covers off all of the different places that the changes need to be made and could possibly be used as a basis for the new plugin / code.
I am happy to do all the testing and research if anyone is able to provide some coding experience to the mix. please just get in contact with me and i will show you everything i have found so far. then we can publish the code into the trac ticket and hopefully the main devs can put this into core.
If anyone has any ideas on blocking issues for this also please tell me.
I know one of the potential issues and the reason for this structure in the first place was duplicated urls. Could anyone please explain the thinking behind this. and how it might present an issue.
I know the current topics post type wont alow duplicates so the only issue i can see would be if the forum name was the same as a topic name. Is that the only time this might happen?
If so we would need to create a check when saving the url/permalink that a forum post type does not have the same permalink and if it does then add 1 to the end?
The way most other forums do this is by appending the thread id into the permalink so it would appear to be /my-friendly-title-11234 for example where the post id is 11234
not saying bbpress should do this but its an option as the id for the post is available.
@casiepa
setting top to zero fixes that !
#bbpress-forums div.bbp-topic-author img.avatar,
#bbpress-forums div.bbp-reply-author img.avatar {
position: relative ;
top : 0px ;
}
Whilst it needs sorting in the core product, the ticket says that putting this in the css file will fix, and did on my test site
#bbpress-forums div.bbp-topic-author img.avatar,
#bbpress-forums div.bbp-reply-author img.avatar {
position: relative
}
https://codex.bbpress.org/functions-files-and-child-themes-explained/