Forum Replies Created
-
In reply to: Removing/Editing “Oh Bother” text
They are php templates inside bbPress. The default location in bbPress is
/plugins/bbpress/templates/default/bbpress/
look for the ones labelled feedback-no-*****.php and alter/edit the ones you want changed and place them into your theme’s bbpress folder.Easy peasy.
Chad
In reply to: Complicated membership solutionI understand why you might want only certain users creating topics.
But, I don’t understand why you wouldn’t want those who can create topics from also being able to create replies.This would seem more functional long term:
membership1 = create topics + create replies
membership2 = create replies onlyAnd like Robin W indicated a simple membership/role plugin could easily set this up. However, limiting those who can create topics to be able to only reply to their own topics would require some custom coding.
I’ve done similar customization, it just takes lots of work as a number of bbPress functions/templates would be affected in both the creating and editing of topics/replies.
And keep in mind all customized functions would need to be periodically updated as security issues arise and other often connected bbPress functionality is updated, as well. This wouldn’t be a set-up once and forget it modification.
Good luck,
ChadIn reply to: Fix slugs (forums/forum/support-clinic)When I say single forum/topic/reply slug I actually meant for the single post-type slugs of forum/topic/reply. As the /forums/ slug is just a wrapper for all those bbPress custom post-types. So you could effectively remove the /forums/ wrapper and end up with just
http://wwww.somesite.com/forum/name-of-specific-forum/
. If you rename the single /forum/ slug to /forums/ it would becomehttp://wwww.somesite.com/forums/name-of-specific-forum/
or something similar with topics likehttp://wwww.somesite.com/topics/name-of-specific-topic/
And adding the topic slug after the forum slug is not intuitive as the topics don’t actually exist inside the forums, they are simply linked to it–similar to a shortcut. This is something that can be done with breadcrumbs, however.
Again, permalinks can be rather tricky. In fact I’m fairly certain they’re the reason the “Private” forums are leading not-logged in visitors to a 404 page. I’d try putting everything back to the default settings and seeing if that fixes the error. Also, look at any customizing, plugins you might have that could interfere with bbPress defaults.
BTW, bbPress has a default error message for not-authorized users and “private” forums that should display. Again, something must be off in the settings/configuration.
My forum has no “private” forums, so I have little experience with this particular issue. Sorry.
Best of luck,
ChadIn reply to: Fix slugs (forums/forum/support-clinic)I understand why you might want to change the permalinks to “clean” your url. However, this helps distinguish forums from topics from replys. For example
somesite.com/forums/forum/some-forum
orsomesite.com/forums/topic/some-topic
.You can remove the “forums” part of the permalink in admin settings under forum and Forum Root Slug–Forum Prefix select off. And you can rename the slug for single forum/topic/reply under same menu and Single Forum Slugs. These built-in adjustments are usually harmless and can be changed as needed.
There are also a few bbPress/WordPress permalink plugins that might help–but they could also make things worse.
Above all, you want a clean url that both makes sense and remains functional. And I’ve found that messing around too much with permalink settings can often break more than fix.
And regarding that “Private” issue: Does it display that when you’re not logged in? That’s a curious quirk.
Chad
In reply to: Third-party shortcodes in bbPress posts@yo35: It can be done. But, you’ll need to either mod the plugin or insert a custom function inside your child theme (while deactivating the plugin to avoid conflicts).
the original plugin code is:
function pw_bbp_shortcodes( $content, $reply_id ) { $reply_author = bbp_get_reply_author_id( $reply_id ); if( user_can( $reply_author, pw_bbp_parse_capability() ) ) return do_shortcode( $content ); return $content; } add_filter('bbp_get_reply_content', 'pw_bbp_shortcodes', 10, 2); add_filter('bbp_get_topic_content', 'pw_bbp_shortcodes', 10, 2); function pw_bbp_parse_capability() { return apply_filters( 'pw_bbp_parse_shortcodes_cap', 'publish_forums' ); }
What needs to change is the section returning the
do_shortcode( $content )
as follows:if( user_can( $reply_author, pw_bbp_parse_capability() ) ) { $content = shortcode_unautop( $content ); return do_shortcode( $content ); }
This will remove the autop filter that adds
<p></p>
to the shortcode text.Good luck.
In reply to: New role not available in version 2.5.12A much appreciated restructuring.
This simplifies a lot by renaming the core roles from within both front-end and back-end user role editors.
Love learning new code/tricks.
Thanks,
ChadIn reply to: New role not available in version 2.5.12Sure,
I’ve been going with Star Trek ranks;-)
function my_custom_roles( $role, $user_id ) { if($role){ switch ($role) { case 'Participant': $role = 'Ensign'; break; case 'Keymaster': $role = 'Captain'; break; case 'Moderator': $role = 'Commander'; break; case 'Blocked': $role = 'Banned'; break; case 'Spectator': $role = 'Visitor'; break; } } return $role; } add_filter( 'bbp_get_user_display_role', 'my_custom_roles', 10, 2 ); function add_new_roles( $bbp_roles ) { /* Add a role called lieutenant */ $bbp_roles['bbp_lieutenant'] = array( 'name' => 'Lieutenant', 'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ), ); return $bbp_roles; } add_filter( 'bbp_get_dynamic_roles', 'add_new_roles', 1 );
As I said, things are all working properly now without any issues.
But, maybe there’s a deeper problem during the update process that might be affecting others as well.
Anyhoo, Thanks.
ChadIn reply to: New role not available in version 2.5.12OK. Well after some harrowing attempts to rebuild from older versions of bbPress and WordPress I ended up reverting back to the most recent of both, 4.7 and 2.5.12, respectively.
And presto! Everything is now as it should be. WTF?!
Maybe something got fouled up in the DB conversion or I simply needed to kick something loose.
Anyway, nevermind.
Thanks.
In reply to: Capabilities and RolesYeah, the role of moderator would allow this user to edit topics/replies. Check out the prebuilt roles/caps here.
Also, by giving them the role of author they’d gain access to the back-end of your site for other content (create posts, etc.), as well.
These are two separate roles that do two different things.
In reply to: Topic tags deleted by other participantsTo avoid this problem you can simply replace
<?php if ( bbp_allow_topic_tags() ) : ?>
with<?php if ( bbp_allow_topic_tags() && current_user_can( 'moderate' ) ) : ?>
in your child-theme’s form-reply.php file.This would prevent any non-moderator from gaining access to the topic-tags designation of the parent topic while adding/editing replies.
Still feels kinda hacky. But, whatever works.
In reply to: Front-end editor for forums?Nevermind.
I found a workaround by adjusting my rewrite rules for forum post type and now all works well.
In reply to: Front-end editor for forums?OK, this is weird. I’m able to front-end edit forums –but only at the root level.
For example, if my structure is
/forums/forum/first-level-forum/second-level-forum/third-level-forum/
I’m able to edit first-level-forums only (with/forums/forum/first-level-forum/edit/
). Any attempt to add/edit/
to any second or third level forums results in a 404.I’ve tried bringing my second and third level forums urls to root level like
/forums/forum/second-level-forum/edit
but that also gives a 404–unless, of course, I actually move the forums to the first level.Is this a configuration issue that can be fixed? I’ve tried both pretty and unpretty permalinks and the problem persists using
?forum=second-level-forum&edit=1
. But, once again, it works with?forum=first-level-forum&edit=1
.In reply to: Minimum Topic & Reply LengthI know this is an old post. However, I’ve been screwing around with various javascript suggestions from other forums and came up with a solution that works (no problems yet discovered). I’m not exactly a code ninja, so if anyone can help to streamline the code let me know.
Just insert the following lines into a custom javascript for your theme (if you need guidance on this there’s a lot of help available all over wordpress.org and other forums).
jQuery(function($) { var forum_input = $( '#bbpress-forums textarea' ); var forum_button = $( '#bbpress-forums .submit' ); var forum_limit = 50; var forum_class = $( '<div class="forum_limit_info"><span>' + forum_limit + '</span> characters needed</div>' ).insertAfter( forum_input ); forum_button.hide(); forum_class.show(); forum_input.bind( 'keyup', function() { var forum_length = $(this).val().length; var chars_left = forum_limit - forum_length; $( '.forum_limit_info span' ).html( chars_left ); if (forum_input) ( chars_left > 0 ) ? forum_class.show() : forum_class.hide(); if (forum_button) ( chars_left > 0 ) ? forum_button.hide() : forum_button.show(); }); });
Basically this function hides the submit button and displays a countdown text counter until the minimum length is reached and then the button appears and the counter disappears.
There are ways of hard-coding a minimum into php but I believe you have to edit core files and then insert these modified php files into a child theme. I couldn’t figured out how to insert a simple php function that would do what I wanted in a clean and simple way. So javascript it is.
The
forum_limit
setting can be anything you want it to be, just change it. And you can customize your topics and replies minimums separately, if needed, with separate javascript functions usingtextarea#bbp_reply_content
,textarea#bbp_topic_content
instead of#bbpress-forums textarea
.For my CSS stylings I chose to put a
:before
message on the left and the character count on the right using these:.forum_limit_info { text-align: right; font-size: 13px; color: red; line-height: 1.2; margin: 5px 5px 0px; } .forum_limit_info:before { float: left; content: '(Minimum Length: 50)'; color: blue; }
CSS Styling is theme dependent and can basically be however you want/need it to be–very flexible.
I also created a similar javascript function for my site’s commenting system. Here’s that code as well:
jQuery(function($) { var comment_input = $( '#commentform textarea' ); var comment_button = $( '#entry-comment-submit' ); var comment_limit = 25; var comment_class = $( '<div class="comment_limit_info"><span>' + comment_limit + '</span> characters needed</div>' ).insertAfter( comment_input ); comment_button.hide(); comment_class.show(); comment_input.bind( 'keyup', function() { var comment_length = $(this).val().length; var chars_left = comment_limit - comment_length; $( '.comment_limit_info span' ).html( chars_left ); if (comment_input) ( chars_left > 0 ) ? comment_class.show() : comment_class.hide(); if (comment_button) ( chars_left > 0 ) ? comment_button.hide() : comment_button.show(); }); });
Good luck to all,
Chad
In reply to: Customizing Replies/Topics Admin columnsI actually found the info/code I needed elsewhere:
add_filter('bbp_admin_replies_column_headers' , 'custom function');
and
add_action( 'bbp_admin_replies_column_data' , 'custom function', 10, 2 );
Odd that this particular custom post type must go against the grain and use a non-standard naming scheme for the admin columns. I guess that’s just the bbpress way;)
Thanks for a great forum plugin and being a great community.
Chad
Very much appreciate the feedback.
Now comes the lovely task of building the structure and creating the individual forums:) The best part of web-site creation, the grind.
Thanks for a wonderful support network community.
ChadIn reply to: Request: VotingOdd. That doesn’t happen on my test site.
On my site it allows you vote for topic/replies individually. And you can vote for replies without voting for topics.
I tested it out and now know what’s happening. I’m not using threaded (nested) replies. If you use threaded replies it assumes all that follows is an extension of the first reply/topic and adds the meta to it, not the actual reply.
Unless you absolutely want threaded replies? I don’t because I think it ends up kinda messy–if someone wants to splinter the discussion from the main topic they need to start their own topic instead.
Maybe someone else knows of a potential fix on threaded discussions?
Good luck,
ChadIn reply to: Request: VotingSorry, I just noticed a typo in my post. The php file you need to alter is loop-single-reply.php and it’s going to be in your plugins/bbpress/templates/default/bbpress folder. But it may also be in your theme’s folder if your theme has custom bbpress template files. If your theme has a bbpress folder in it themes/{your theme}/bbpress than that’s the file your need to make your adjustments to.
Make your simple addition: put
<?=function_exists('thumbs_rating_getlink') ? thumbs_rating_getlink() : ''?>
inbetween<?php do_action( 'bbp_theme_before_reply_content' ); ?>
and<?php do_action( 'bbp_theme_after_reply_content' ); ?>
either before the content<?php bbp_reply_content(); ?>
or after it. It all depends on what you prefer.And then put it in your theme’s child folder: themes/{child-theme}/bbpress/loop-single-reply.php.
If you aren’t using a child theme (highly recommended, BTW) you’ll will have to modify this file directly and replace it in the default folder. And, every time you update your theme and/or bbpress you may need to recreate this modification.
And for css modifications you’ll have to insert the appropriate css mods (use Google Chrome to identify the css selectors and properties/values) into a custom.css file/plugin–I either use the one in Jetpack or in a stand alone plugin. You can also add the css modifications into your child theme’s .css file.
–Refer to the plugin author’s support page on wordpress.org. There are a lot of valuable css tips and suggestions. Also, the author had proven to be very helpful in getting his plugin up and running for most people.
Oh, and my website is currently in the development stage and won’t be made public for awhile. I’m building it at my leisure, “The joy of hobby sites.”
Hopefully this clears up a few things. It’s kinda hard to describe everything in detail. I just end up muddling through until it looks/acts OK. As a suggestion make sure you keep a default/unmodded .php file handy to switch back and forth with until everything works. Wouldn’t want to have to bother reupping a new file from a theme/bbpress .zip file every time you screw something up.
Good luck, Chad
In reply to: Hierarchy on non-standard layoutsI could simply use comments if I only wanted to create a single-threaded topic per post. I want an entire forum for each post. Users can create topics and then reply to those topics.
I know it seems a little “big concept”. But, I really want to have engaging discussions with people on a site that encourages multiple threaded topics/discussions for every forum/post. A community sharing problems/solutions and ideas/opinions.
I find most forums overly congested with nearly unsortable content. A giant list of disconnected ideas all piled on top of each other. Even with more aggressive hierarchies, most forums over time simply get too big to manage. By creating easily sorted/navigated single forum pages I can funnel highly specific topics through a less-congested space.
I’m building the site from the server up to maximize performance and user-engagement.
Thanks, Chad
In reply to: Request: VotingI’m trying Thumbs Rating. It doesn’t tie into any user meta, so you can’t restrict the voting to only registered/logged-in users. However, it works very well and very fast. It only adds post meta so it shouldn’t noticeably slow-down your site even with thousands of topics/replies.
After activation, per the plugin developers instructions I put the following code into my loop-single-relay.php:
<?=function_exists('thumbs_rating_getlink') ? thumbs_rating_getlink() : ''?>
goes somewhere between<div class="bbp-reply-content">
and</div>
–this is theme specific and has to be modified based on your needs. I found that placing the vote before or after and not inside the content works best as the “quote” function in the forum(s) gets screwed up with the added voting content.That means before/after the
<?php do_action( 'bbp_theme_before/after_reply_content' ); ?>
Of course, as a lightweight plugin some serious css work is required. And it would be best to place this modified .php file into a bbpress child theme folder to ensure it continues to work after updates.
Good luck, Chad
In reply to: Hierarchy on non-standard layoutsI know of no simple way to create multiple forums with topics/replies for a site without using a pre-structured environment. I’m simply removing the “forum” look and putting each forum on it’s own WordPress styled post/page.
Think something like what IMDB does with movies/talent–where every film/show/person gets its own discussion board.
This way I can use bbpress’s built-in widgets and hooks to direct people to topics/replies while using WordPress menus/templates/tags to direct people to specific discussions.
bbpress is basically a well-designed, feature-rich custom post type plugin that creates post types for topics/replies inside a forum structure. So, I’m using those custom post type functions while not using the structure.
Oh, and sorry about the duplicate topics. I realized this question belongs more appropriately on this forum and had no way to delete the previous post that I put over on “Troubleshooting”.
Thanks, Chad
I don’t want a private forum. I’m building a publicly accessible discussion board site. All I’m looking to do is minimize a user’s ability to see into the forum hierarchy (it’s sloppy).
Whenever someone creates a topic they get 5 minutes to edit it. During that five minutes they have the option through the use of a selector to move that topic to another forum. This lets them see into the forum hierarchy that I’ve built into the site (categories/subcategories etc…). I want to prevent this from happening. They can edit the content, just not the location–I want to leave that to the moderators only.
The css “hides” this selector and its title. However, it is still being queried by the site and it still appears as a hidden element within the browser.
Thanks for the effort, Chad
I actually came up with an in-elegant solution using css.
select#bbp_forum_id, [for="bbp_forum_id"] {display: none;}
Participants are only able to edit posts for 5 minutes–per the default setting. I just prefer that all the backend stuff remain backend stuff.
If anyone has a more elegant solution (one that avoids the needless database querying for ALL the exiting forums/categories for every topic edit) please let me know.
Thanks again, Chad