Step by step guide to setting up a bbPress forum – part 4

Step by step guide to setting up a bbPress forum – part 4

Step by step guide to setting up a bbPress forum – part 4
Codex Home → Step by step guide to setting up a bbPress forum – part 4
Using Actions
Actions and Filters add a powerful way that you can alter how bbPress (and of course WordPress) work.
For the newcomer to WordPress, they are also probably one of the hardest to find information on. This tutorial tries to demystify some of this area, and help newcomers code those changes that will make their site work how they wish.
This section deals with actions.
1. Actions
These are things you can get wordpress to do at a particular point in the code.  So if you want to add something to an area, then an action is probably what you want.  WordPress and bbPress are full of actions points throughout the code.
So lets look at what one looks like, so that you can recognise it

They start with do_action and then each one has a unique action name.
This example above occurs in the bbPress code before the author avatar on a topic or reply
So if you wanted bbPress to say the words 「Posted by」 before the author details are shown in a topic or reply, you』d create some code that would 「hook」 to this action, and that』s what the code will do.
2. Finding the code
So where is the code that we need to look at?
This is of course the first issue with bbPress (as with any other part of WordPress – finding out what file needs to be altered.
All the critical template files (the most likely you』ll want to alter) are held in the folder
Wp-content/plugins/bbpress/tempaltes/default/bbpress
Whilst many of the names give a good clue to what they do, you』ll probably need to delve into a few before you find the one you want.
I plan to make a list of these templates and what they do if/when I work it out!
For the meantime, just look through, and you should find.
3. Where to add actions
In this tutorial, we』ll look the code you need to create, but obviously that code needs to go somewhere.  So where do we put it?
We add actions either to the functions file, or create them as a plugin.
Both methods have uses.
If you like using plugins, then they』re a good way to add changes, and work well if you have a number of sites, as the plugin is easily uploaded to each.  But they do require a bit more knowledge to code.  But google the subject and you』ll find lots of help on creating one.  Then just put the code into it, and upload to your site. If you want others to use your clever code, then a plugin is a definite.
The alternate is to use a functions file.  As you are now at the 「advanced」 stage of using WordPress, you should either be developing your own themes, or using a Childtheme to store the specifics.
If you still just have a main theme from someone else (eg a wordpress default theme, a free theme or a premium theme), then you should create a childtheme.  This simply uses the main theme, and the you can add your tweaks to the childtheme.  Then if the maintheme is updated, you tweaks in the childtheme are not overwritten.  For help on creating a childtheme  google 「child theme wordpress video」 and you』ll find lots of demonstrations.
If someone has built a site for you, it may already be a in a child theme, and again the video』s will let you see whether this is the case.
Within our childtheme, we』ll put a functions.php file, and the actions we set up will go in there.
4. Example of code we can alter
So to start to understand what we need to do, lets have a look at one of bbPress』s templates and see where these are used.
The file we』ll look at is called 「loop-single-reply.php」 and the dafault is held at
wp-content/plugins/bbpress/templates/default/bbpress/loop-single-reply.php
Loop single reply is the template that  is used by bbpress to display a topic and the replies associated with it – eg this page

If we start to look at this file we』ll find at around line 39 the following

'
', 'show_role' => false ) ); ?>

This part of the code displays the author details.
Line 1 – So the first things we see is an action an action for 『bbp_theme_before_reply_author_details』
Line 2 – This is followed by the bbp_reply_author link code which displays the author avatar, name, and role.
Line 3 – tests if the viewer is keymaster
Line 4 – if the viewer is keymaster, you can add some admin things to do here.
Line 5 – if the viewer is keymaster,displays the IP address of the author
Line 6 – is another action we can hook to after it has displayed this
Line 7 – ends the 「if admin..」 statement
5. Adding a simple action
So as stated above, if we hook to 『bbp_theme_before_reply_author_details』, we can add text or data at this point
So lets add 「posted by」 to the start of the author display area.
To do this we』ll simply hook to this action.
In effect we create a bit of code with

a name
what we want to hook it to, and
what we want it to do

The name must be unique, as other plugins, themes or indeed you could have actions that should be carried out at this point.
So this is what I coded :
//this function hooks to BBpress loop-single-reply.php and adds "posted by" before the author details
function robin_w_posted_by ()
 {
echo 'Posted by' ;
 }
add_action ('bbp_theme_before_reply_author_details', 'robin_w_posted_by') ;

So let』s pick this apart
Line 1 – starting 『//』 is a comment line. You may know today what this function does, but in a few months time, you may not, so comments are good to remind you !
Line 2 – This sets up a function and calls it  『robin_w_posted_by』.  Functions within your website must be unique, so adding your name at the start will make it highly unlikely that any WordPress, bbPress or any plugins you have will already have this name.
Line 3 – The actual function code is then contained in the {  } so this opens the function code area.
Line 4 – the function code – in this case it is a simple 『echo』 command
Line 5 – closes the code area
So that creates the function, but now you must hook it to the do_action command in the bbPress code, that is tell WordPress where to implement it.
Line 6 – The final 『add_action』 command tells WordPress to add an action to 『bbp_theme_before_reply_author_details』 called 『robin_w_posted_by』 – the function we』ve just created.  And that』s it!
so

becomes

6. Adding an Action – further example
This example adds a post count to the author area, using the do_action( 『bbp_theme_after_reply_author_details』 ) action hook
//this function hooks to BBpress loop-single-reply.php and adds the post count to the reply display
function robin_w_display_count ()
{
$post_count = bbp_get_user_post_count( bbp_get_reply_author_id( $reply_id )) ;
echo "
Total posts : " ;
echo $post_count ;
echo "" ;
}
add_action ('bbp_theme_after_reply_author_details', 'robin_w_display_count') ;

Very similar to the first example, but here we set a variable called $post_count to the count and then use this to display the count.
The result:

Official Logos and Icons

Official Logos and Icons

Official Logos and Icons
Codex Home → Official Logos and Icons
Transparent PNG:
bbPress – Logo Large 1259px x 363px

bbPress – Logo 2x 416px x 130px

bbPress – Logo 208px x 65px

Dashicons Icons:

bbPress Logo: content: "f477"; – class="dashicons dashicons-bbpress-logo"
Forums/Hive: content: "f449"; – class="dashicons dashicons-bbpress-forum"
Topics/Honey: content: "f450"; – class="dashicons dashicons-bbpress-topic"
Replies/Bee: content: "f451"; – class="dashicons dashicons-bbpress-reply"
Note: The dashicons CSS classes will only work with WordPress 3.9 or newer.

Color:

bbPress Green #2d8e42

bbPress 条件标签

bbPress 条件标签

参见 WordPress Codex https://codex.wordpress.org/Conditional_Tags

is_bbpress()

/** 档案 *****************************************************************/

bbp_is_forum_archive()

bbp_is_topic_archive()

/** 话题标签 **************************************************************/

bbp_is_topic_tag()

bbp_is_topic_tag_edit()

/** 组件 *************************************************************/

bbp_is_single_forum()

bbp_is_single_topic()

bbp_is_single_reply()

bbp_is_topic_edit()

bbp_is_topic_merge()

bbp_is_topic_split()

bbp_is_reply_edit()

bbp_is_reply_move()

bbp_is_view()

/** 用户 ***********************************************************/

bbp_is_single_user_edit()

bbp_is_single_user()

bbp_is_user_home()

bbp_is_user_home_edit()

bbp_is_topics_created()

bbp_is_replies_created()

bbp_is_favorites()

bbp_is_subscriptions()

/** 搜索 ***********************************************************/

bbp_is_search()

bbp_is_search_results()

Step by step guide to setting up a bbPress forum – Part 1

Step by step guide to setting up a bbPress forum – Part 1

Step by step guide to setting up a bbPress forum – Part 1
Codex Home → Step by step guide to setting up a bbPress forum – Part 1
bbPress is a plugin for WordPress that adds forum capability to your site.
bbPress inherits your currently active theme』s styles where it can to try and match your themes style. This can work really well on some themes, but sometimes doesn』t work well on others, so some styling may be needed. Out of the box, it works well with most of the default WordPress themes , but like I said it might need minor CSS styling to fix some layout issues.
Setting up WordPress requires some or all of the following stages depending on how you want it to look.
The instructions here generate a forum working within a twentyten theme that looks like:

 
In summary you need to

Install the plugin
Set up some test forums or import a forum
Create a WordPress page for your forum display
Amend any other settings
Hidden vs. public forums – decide which or a mixture suits you
Decide on registration/user logins – automatic or manual?
Manually adding users to your forum – if you have chosen this route.
Make sure bbPress uses the page template we want
Add a custom sidebar or use existing sidebar with conditional logic

So let』s get started.
 
1. Installing the plugin
So we』ll assume you have a site with wordpress installed
Go to dashboard>plugins>add new
You will see bbPress part of the featured plugins then install and activate.
You can also type 『bbpress』 into the search bar , and that should lead you to the latest version then install and activate from there.
 
2. Set up some test forums
Go into Dashboard>forums>add new
Add a forum and name it whatever you want, but you need at least one to get the forum page going (you can always delete it later).
Now go into the dashboard>topics and create a new topic.  Again you can trash this later, but you』ll want to see what one looks like.
Okay, so now we have bbPress with one forum and one topic, but we』ll need to show it somewhere,  so go to 3 below.
2. Alternative  –  Import a forum !
If you』re planning on migrating from a different forum and would like to use bbPress but keep all of your original forum data, then you will need to import your existing forum data into bbPress.
To import forums go to Dashboard > Tools > Forums and go to the tab 「import forums」
If you need anymore help during this importing process there is a guide that will help you here.
https://codex.bbpress.org/document/
 
3. Creating a forum page
Now we have some forums, we need to have somewhere to display them.
There are two ways to do this. Most themes support method 1, and this can (can not will) produce tighter theme integration on style . However Method 2 allows you to have some introductory words. Your choice…!
Method 1
This requires a couple of checks first
a. In Dashboard>settings>forums look for what is set in the forum root under the forum root slug heading. The default is 『forums』 but you can set this to anything
b. In Dashboard>settings>permalinks check that the common settings check is set to 『postname』 If it isn』t and you don』t want to change it, then use method 2.
Now just create a wordpress page that has the heading that was found in a. above eg if the root slug is 『forums』 create a page with the title 『forums』, and save.
Once the permalink has been created, you can rename the page to whatever you wish eg 『mysite forums』 (as the permalink will stay the same, and it is this permalink that bbpress looks for)
Save this page, add it to a menu if you are using custom menus, or decide its order if you have automatic menus. Then publish it to your site.
Job done!
Method 2
If either your theme doesn』t work with method 1, you don』t want permalinks with postname, or you want to use some introductory text (eg 「welcome to our forums…」, then method 2 is for you.
In dashboard>pages
go to add new page
Call this 『Forums』 or whatever you want your menu item to be.
Then in the content section, you may want to have some introductory words 「welcome to the forum」 etc. then add the following bbpress shortcode
[bbp-forum-index]
Save this page, add it to a menu if you are using custom menus, or decide its order if you have automatic menus. Then publish it to your site.
You will now have a forum page, and a forum to display.
 

4. Amending any other settings
There are several parameters which you can set to get bbPress working as you want it.
These are accessed via Dashboard>Settings>forums
See  https://codex.bbpress.org/document/configuring-bbpress/forum-settings/  for further details.
 
5. Forum Visibility and access
You can use a combination of forum visibility and registration to set up who can :
see your forums
post in your forums
Forum visibility:
Public – Anyone can see these forums
Private – Only logged in registered users with a forum role  can see these forums
Hidden: Only Moderators/keymasters can see these forums
Visibility is set for each forum, go into Dashboard>forums> and when you add/edit a forum, you will see visibility options on the right hand side in the forum attributes.
Users then have a forum role which can be
spectator
particiapant
moderator
keymaster
blocked
 
Forum access
You can set whether users need to be registered and control the registration process.
These two controls give you various degrees of control
Public viewing, public posting
By default forums are available to be publically viewed.  If you set anonymous posting to be on (see 4. Above) then anyone can also post.  This is the most public version of the forum.  It can lead to lots of spam being posted, and does hand control of what』s said in your forums to the internet community, with you effectively being able to only delete afterwards.
Public viewing, registered user posting
Here anyone can view the forums, but only registered users can join in and post.  Registration can be automatic or manual – see 6. below
private viewing, registered user posting
Here you have a private forum. Only registered users can view and post.  Here it would be very unusual to allow automatic registration, and this will be typically a manual process.  To set a forum as private go into dashboard>forums and select edit for the forum you wish to be hidden.  Under the forum attributes on the right hand side, set visibility to private.
 
6. Automatic vs manual registration
If you do not permit anonymous posting, then your users will need to register with your site. It is up to you to decide which method is preferable.
Automatic registration is easier and it does allow people to quickly sign up, but by the same token gives you less control over who is contributing to your forums, and can lead to spam postings.
Manual signup involves you in more administration, but does give you complete control over who has write access.
Neither is better overall, but one will be better for you !
To allow automatic registration, go to Dashboard > Settings > General settings and under membership, tick 「anyone can register」.  Then in Dashboard > settings > forums tick the auto role, and ensure this is only at participant level.
To set manual registration, go to Dashboard > Settings > General settings and under membership, and ensure  「anyone can register」 is not ticked.  Then in Dashboard>settings>forums tick the auto role, and ensure this is only at participant level.
In both cases, you will then need a screen for users to register – we』ll come back to where to put this screen later, but for the moment go into dashboard>pages>add new page and create a page.  You can call this page anything you like but 「register」 or 「registration」 would be logical when users view or access its URL.
If you are doing automatic registration, then put whatever preamble you』d like (「to register for our forums」 etc.) , and then add the following shortcode  [bbp-register].  Save the page.
If you opt for manual registration, then you』ll either need to get your users to email you, or set up a contact form for them to use.
To get you going quickly, maybe just set the page to have you preamble followed by an email link such as
email us your details here
Remember to write this in the 「text」 tab of the content, so that the html is understood.
There are lots of contact form plugins, which you can use later to get a registration form going on this screen.  By all means set this up now, but a placeholder email will get you enough to see how it works.
So now we have a page where our users can register.
 
7. Manually adding forum users to your site and editing them.
If you have opted for manual registration (and it』s what  I do), then when you receive either a contact form or email as set up in 6 above, you』ll need to add each user.
Go into Dashboard>users>add user
Enter their details as required.  You can use the 「send email」 to automatically send them their details from within your site, or you can email external to the site afterwards using your favourite software.  I use an email template within outlook as I can then send 「joining instructions」  and 「forum rules」 as part of the signup.
You』ll not see any bbPress forum related user options/settings at this stage.
If you want to set/amend access level – say to make a user a moderator, then you』ll need to create the user first, and then go back into edit, and now you』ll see an option at the bottom of the amend screen to allow you to change access levels.
Manually adding users also allow you to take away the 「toolbar」 , which I feel always draws away from the look and feel of the site.  We』ll give profile access later in this setup, so it』s not needed.
WHERE HAVE WE GOT TO?
So we now have a forum (or two) on a page which is accessible from the menu.  We』ve decided if any/all forums will be hidden, and who and when people can contribute.  We』ve set up a registration process (albeit the manual one might be a bit basic).
However we』ve not given anyone a place to logon, or indeed register, or anywhere where they can see the latest posts.
You can do this by adding these into a sidebar, or if you are using a full-width page, but adding them to a menu.
But first you need to see if you need to change what page template bbPress is using for your site.
 
8. Make sure bbPress uses the page template we want
So you may want bbpress to display differently than the template it chooses for instance you might want your forum on a full width page and find that it uses a sidebar template, or visa versa.
If you have some knowledge of editing files then follow this guide to help create a bbpress.php file to use for all your bbPress pages.
https://codex.bbpress.org/theme-compatibility/getting-started-in-modifying-the-main-bbpress-template/
Otherwise a more basic explanation follows :
By default bbPress will use a page template in your theme root folder.
It will look for the existence of several files in the following order, using the first one it finds.
plugin-bbpress.php
bbpress.php
forums.php
forum.php
generic.php
page.php
single.php
index.php
Typically most (but not all) themes have a page.php, so if you do nothing else, chances are that that』s the one it will use.
To get bbpress to use a different template from the one your theme is using just copy that template and rename it bbpress.php within your theme root. This is explained a bit more below.
So you may want bbpress to display differently than the template it chooses for instance you might want your forum on a full width page and find that it uses a sidebar template, or visa versa.
You can even find that bbPress appears differently when displaying the forum index than it does with topics, which is probably not what you want. Nowadays theme developers will quite often use 「if…」 code within the page template to change the display of types of pages. Since topics share the same characteristics as posts, but the index page is more like an 「about」 page, the theme can believe that it should show then in different ways.
If bbPress is using the page layouts you want, then that』s fine, and you can ignore the rest of this section.
If not, then the following will let you set bbPress up in the way you want.
You theme will have page templates in the root of the directory, that is :
wp-content/themes/%mytheme%/ where %mytheme% is your theme』s name.
You』ll need to find the name of the page template that you want to use. Look in your theme』s directory – normally they are named very obviously – eg pagefullwidth or pagesidebar. If it』s not obvious, you can see what the template is called by editing a page that has the correct layout, and looking at the name of the template on the right hand side of the edit screen in a panel under the publish/update panel. If you then open the various page.php files, you see that they are named in the first few lines, so you can easily match the name.
So once you know which page template file you need, copy this and rename the copy to bbpress.php
Place this file in the root of your theme ie wp-content/themes/%mytheme%/bbpress.php where %mytheme% is your theme』s name.
bbpress will the use this file for all it』s pages.
If you want to customise the layout for your forums, you can then do this within this file.
 
9. Creating a forum specific sidebar
For most sites, the forum is part of a larger experience, and it is really useful to have a separate sidebar for the forum page that has forum specific widgets on it.
If your forum is all that is on your site, then the default sidebar may be all you need. But If you want to add a sidebar just for your bbPress pages then please follow this tutorial.
Creating a bbpress specific sidebar
 
10. Adding forum menu items
If you don』t use sidebars or footers to display your login and register items, (or even if you do) you』ll probably want to add some menu items.
You can do this quite easily here is how.
First you go to Appearance > Menus.
If you haven』t created a menu for your site , then create one.
You then select the menu you want to edit.
Now you go to the Custom Links section to your left and enter the url of the form you want to lead them to.
So the url of the login form of your site would be
http://yoursite.com/wp-login.php
Where 「http://yoursite.com」 is your sites url.
And the Link Text would be 「Login」.
If you want to put a link to the registration form it would be
http://yoursite.com/wp-login.php?action=register
And the lost password form would be
http://yoursite.com/wp-login.php?action=lostpassword
You can of course use front-end login forms and link to them,
You can also use this plugin to control when to show these menu links to users when they or logged out or haven』t created an account to your site.
https://wordpress.org/plugins/menu-items-visibility-control/
 
AND THAT』S IT !
Now you have a fully functional forum !!!!
Users can register, login, see what forums are available, and contribute.
It may look a little rough at points, this will be clashes between bbPress and your theme, and we』ll start to deal with these in part 2

bbp_get_user_profile_url

bbp_get_user_profile_url

bbp_get_user_profile_url
Codex Home → bbp_get_user_profile_url
Description
The 『bbp_get_user_profile_url』 function returns the URL of the supplied user』s profile.
How to use it

$user_id – The specified user to return the profile link for.
Sample code example

<a href="ID); ?>">Your Forum profile

Creates a link to the current user』s profile.

Step by step guide to setting up a bbPress forum – part 2

Step by step guide to setting up a bbPress forum – part 2

Step by step guide to setting up a bbPress forum – part 2
Codex Home → Step by step guide to setting up a bbPress forum – part 2
WHERE ARE WE?
Part 1 dealt with getting the forum going.
Part 2 deals briefly with plugins, but mainly with changes to styling and bbPress.css
Part 3 will dealt with layout and functionality.
The forum is now fully functional, but probably you』ll want to change some of how it looks. If you』re using anything but a default theme, I expect that the colors won』t look right, and you may want to change some fonts.
You may also want to change where elements are displayed. Or add other functions to your site.
So there are two types of change we might want to make to our site –

changes in style – how it looks, and
changes in functionality – how it works.

Changing bbPress to achieve both these can consist of 4 things:
1. Changing CSS
2. Adding Plugins
3. Changing function files
4. Changing PHP files
This part 2 deals with changes in style which means primarily changing css.
Summary for techies
If you』re already into css, then bbpress uses by default a file called bbpress.css located in wp-content/plugins/bbpress/templates/default/css
Either just override styling in your theme』s css, or copy the bbpress.css file to a folder
/wp-content/themes/%your-theme%/css/
and bbpress will use that file, so make changes there.
A quick bbpress styling crib is available to get you started.
1. What is css?
CSS stands for Cascade Style Sheet – it』s a simple way to define elements of the site that will be used often. For instance if parts of your website have a heading, then defining a heading style once (font size, color, font used, bold, italic etc.), and then simply referring to it each time a heading is displayed is much easier than defining it each time.
Now we can override the default CSS elements in 4 ways

With a css plugin
Adding code to our child theme』s style.css
Copying/creating a bbpress stylesheet in your child theme
With functions (see below)

2. Using a CSS plugin
There are several around, including https://wordpress.org/plugins/simple-custom-css/ just google 『WordPress css plugin』 to find one right for you.
Using these you can add css to your site without needing to code in files, and if you』re only doing a few small changes, this can be an easy way without fearing that you』ll ruin a file on your website.
However if you doing all but a few small changes, you would be better looking at the remaining options
So in this section we』ll deal with b & c.
But before we do that, we need to understand a bit more about how to change files without losing our work later on.
3. Changing files Overview – get a child theme !
To make bbPress work or look better without plugins, we』ll need to change files.
Now if we simply change the files in bbPress, then any updates to bbPress will risk losing these changes, and undoing all your hard work.
So we will make changes in our WordPress themes, leaving alone the bbpress plugin directory.
If you』re in to writing your own WordPress themes, then I suspect you』ll be skim reading this article, so the next bit is for those of you that are either using a WordPress default (twentyten, twentyeleven etc.) or have chosen one of the many free or paid for themes.
If you have gone for any of the above, then again if you simply make changes to the theme, then any updates to your theme will risk losing these changes, and again undoing all your hard work.
If you are a bit more advanced, you may already have a child theme, and it is here that we』ll make additions and changes. That way updates will not affect lose the changes we have carefully crafted.
If you don』t currently have a WordPress child theme, then the best way to proceed is to create one, and then you can make changes there.
If you don』t know how to create one, the WordPress Child Theme training module is a great place to start, also search google 「child theme wordpress video」 and you』ll find lots of demonstrations. If someone has built a site for you, it may already be a in a child theme, and again the video』s will let you see whether this is the case.
So let』s presume you now have a child theme…
bbPress picks on the styles used in your theme for some elements, but uses its own CSS style sheet for others. This default css works well with the wordpress twentyten theme, but may not look right with your theme.
4. Adding code to our child theme』s style.css
If you』re making just a few changes, then adding the code to your child theme』s style.css is the easiest way to go
We』ll come later to the key bits of code you might want to change, but for the moment let』s suppose that you don』t like the way bbPress lists the forums.
The default looks like :

And you』d like it to look like :

This element is styled in the original bbPress.css file as followed
#bbpress-forums .bbp-forums-list li {
display: inline ;
font-size: 11px;
}
Changing the 『display:inline』 to 『display:list-item』 will achieve this. But as we said above, whilst you could simply amend line 121 (in wp-content/plugins/bbpress/templates/default/css/bbpress.css) you don』t want to alter this, as upgrades to bbPress versions might well overwrite this.
So we simply enter the appropriate code in our child theme』s style.css.
We can enter the entire 「chunk」 of code, and if you』re copying from bbpress.css, then copying the entire chunk and then altering just the bits you want will help you remember what other parameters are there
So
#bbpress-forums .bbp-forums-list li {
display: list-item !important;
font-size: 11px;
}
achieves this. Equally well you could post
#bbpress-forums .bbp-forums-list li {
display: list-item !important;
}
ie just the bits of the code that you actually want to change.
NOW you may have spotted that I』ve added 『!important』 to the line. This is because our theme style.css file will execute first, then the bbpress.css (being a plugin) will execute afterwards. Since the later bbpress.css file contains the original code, this will simply overwrite the changes you have made. By entering 『!important』 to the line, you tell WordPress not to allow this code to be overwritten by later code, so preserving your change.
So that』s method 1, using your child theme』s style.css.
5. Copying/creating a bbpress stylesheet in your child theme
The alternative method is to either take a copy of bbpress』 default css or create a brand new one, and put this in a specific area of your theme that bbpress looks for.
For .css files, bbpress looks at you theme files in the following location :
/wp-content/themes/%your-theme%/css/
where %your-theme% is the actual directory name of your theme.
So any .css file found in this location will be used. I am not sure if this is instead of the bbpress.css file in the plugin default location or in addition to it. You will need to check that yourself, as at the time of writing I have not!
So your best bet is to copy the bbpress.css from wp-content/plugins/bbpress/templates/default/css/bbpress.css
To a directory called css as above in your theme directory.
You can then edit this theme to your heart』s content, knowing that it won』t be overwritten by any bbpress upgrades.
So if you』re now ready to start changing code but what can you change?
See bbPress styling crib to get you started.
6. Changing colors
For people starting out with css, knowing what exact color something is  can be tricky. So if your main theme has a background of a light blue – how do you get that exact same shade in bbpress.
More technical people will use features within browsers to show them the underlying information. For instance many people use a product called 「firebug」 with a Firefox browser to show them exactly what is happening, including what exact colours are being used for text and backgrounds. These tools can be extremely useful as you progress, and it』s worth getting to know them if you plan more than a couple of changes. Google 「firebug video」 to get lots of help such as Firebug tutorial
An alternative if colors are what you』re after is to use a product like colorcop which will let you see exactly what color is being used on any part of your screen, so copying either your own theme』s colors or someone else』s is really easy.
The next section deals with changing layout and functionality part 3

审核和黑名单

审核和黑名单

bPress 使用与 WordPress 用于评论的相同的审核和黑名单工具。如果您希望用户的话题和回复受到额外审核,和/或完全禁止发布,您可以使用评论审核和评论黑名单设置,位于:

管理后台 > 设置 > 讨论

当在您的评论审核设置中发现包含单词的话题或回复时,它将被置于待处理状态,而不是立即发布。

当发现某个话题或回复在您的评论黑名单设置中包含某个词时,它会被阻止发布,并且用户会收到一个相对通用的回复,例如:

目前无法创建您的话题。

响应保持通用的原因是,冒犯的用户不会被发现问题,然后他们可以尝试使用空格、符号或其他 Web voo-doo 来规避。

您目前无法修改这些响应的结果,尽管该 bbp_add_error() 功能的核心补丁可以在 bbPress 的未来版本中相对轻松地启用它。

Step by step guide to setting up a bbPress forum – part 3

Step by step guide to setting up a bbPress forum – part 3

Step by step guide to setting up a bbPress forum – part 3
Codex Home → Step by step guide to setting up a bbPress forum – part 3
Part 2 of the guide dealt with styling changes.
This part will deal with changing what appears and where it appears – changing some of the functionality of bbPress.
Now you can alter functionaility in many ways. These include
1. with plugins
2. with functions
3. by changing bbPress files
4. adding filters
5. adding hooks
1. Plugins
If you』re not familiar with coding, then plugins can offer a great way to add functionality without needing to do coding. There are lots around, if you』re after something it』s always worth trying a google search with 「bbpress plugin」 and whatever you are after.
Some I have used include :
bbP signature – lets users add a 『signature』 to their posts – used a lot in forums
bbP topic views – displays how many times a topic has been viewed
and ones that might well be useful, but I haven』t used :
bbpress-notify – notifies admins, moderators etc. (fully configurable to role) when new post and replies are made
The rest of this part will assume that you have a child theme, if you』re not familiar with what this is and why you need it, please visit part 2 of this guide where it is all explained.
So lets assume you have a child theme.
2. Functions
A short guide on how to create a child theme and functions file can be found here
Functions files and child themes explained
3. Changing bbPress files
This part of the guide is primarily going to deal with the bbPress templates that the default bbPress plugin uses to display your forum.
NOTE: This part deals with changing templates that belong to the bbPress Plugin, and these changed templates should then reside within a bbpress folder in your theme.  HOWEVER if you create a bbpress.php file from a theme template or php file (that is a file that sites in your theme such as page.php) , then this resides in your theme』s root.  So if the source is the plugin, then bbpress folder;  if the source is your theme, then your theme folder !
Changing these files gives you a powerful way to improve how your forum works for your users, and in some cases making it easier for you to administer.
In part 2 we explained how changing files in the bbPress plugin was not a good idea, and these files are frequently overwritten on an upgrade. So to change files, you』ll need to copy them you your child theme.
Bbpress will normally use the default files found at
wp-content/plugins/bbpress/templates/default/bbpress
However if you create a directory in your child theme at
/wp-content/themes/%your-theme%/bbpress/
(where %your-theme% is your child theme』s name)
then any files stored there will be used instead.
This means that if you want to alter how a topic displays, then copying the relevant file (in this case loop-single-reply) to this folder will mean that bbPress uses this file instead, so you can now alter it to work how you want.
There are two sources that you might want to use for files – one is at
wp-content/plugins/bbpress/templates/default/bbpress
For instance in this bbPress folder you』ll find
loop-single-reply – this file displays a topic and all its replies letting you change the heading and the format within a post – for instance removing the avatar or adding extra words below it.
If you want to alter lower level files, then the other source is
wp-content/plugins/bbpress/templates/default/extras
Here you can alter for instance whether a single topic has a footer.
To alter any of these lower level files they need to be copied to the root of your child theme that is to
/wp-content/themes/%your-theme%/
(where %your-theme% is yout themes name).
So bbPress offers a simple way to change the layout and information displayed.
As an example, the default forum display looks like

which displays the forum counts for the sub-topics.
If you wanted to take these out to look like

Then you would need to change
loop-single-forum.php by changing how the code displays
so you would change line 44  from
 

 
to read
 
false,
『show_reply_count』    => false,
『separator』 => 」,
));  ?>
 
So copy the file loop-single-forum.php from wp-content/plugins/bbpress/templates/default/bbpress to /wp-content/themes/%your-theme%/bbpress/
and add the above function. Then save, and hey presto, the counts have gone !
For some starters on what you might want to change have a look at Layout and Functionality – Examples you can use
Part 4 deals with adding actions and
Part 5 deals with adding filters

bbp_reply_author_link

bbp_reply_author_link

bbp_reply_author_link
Codex Home → bbp_reply_author_link
Description
The 『bbp_reply_author_link』 function is used to display the current reply author』s user role, avatar and username linked to their profile
Where is it used
Templates: loop-single-reply.php loop-search-reply.php
How to use it
1
$args (optional) – Accepts an array of arguments to configure display ( post_id, link_title, type, size, sep, show_role )
Uses bbp_get_reply_author_link()
Sample code example
1
Displays the linked avatar and username for the current reply author
1 '
', 'show_role' => true ) ); ?>
Displays the current reply author and user role separated by an HTML
element
1 '
', 'show_role' => true, 'size' => 32 ) ); ?>
Displays the current reply author and user role separated by an HTML
element and sets their avatar to a size of 32px wide and 32px tall
1 '
', 'show_role' => false, 'type' => 'avatar' ) ); ?>
Displays only the current reply author user』s avatar without their display name or user role
1 '
', 'show_role' => false, 'type' => 'name' ) ); ?>
Displays only the current reply author user』s display name without their avatar or user role
Related
bbp_author_link()
bbp_topic_author_link()