showing twice is the way bbpress likes doing it !
You can turn off the forums root slug in settings>forums
or play with this code
Layout and functionality – Examples you can use
Don’t know how the latter would work with your plugin
Hi all,
I’m trying to figure out how to get a specific forum to be shown on a page and to keep users on that page.
I’m using the following shortcode:
[bbp-single-forum id=9232]
This does the job of showing the specific forum on the page, but it when a user posts a new topic or clicks on a topic to read it, it takes them to the bbPress page:
/forums/topic/test-topic
Is it possible to keep the user on that page throughout the process? I have different forums for separate members (using the Groups plugin), and would like to control who can see what from that single page.
Thanks 🙂
looks good, have you tried it and does it work,
If so I’ll add it to the codex
@star100
Layout and functionality – Examples you can use
no. 14 & 15
@bob1nz
Thanks, I’ve updated the codex, as I say it doesn’t like switching between visual and text, and alters the code if you do. Sop thanks again it should now read correctly
Maybe better like this :
add_action( 'bbp_template_before_single_forum' , 'xxxx_bbp_display_forum_description' );
function xxxx_bbp_display_forum_description() {
$display_forum_description = bbp_get_forum_content();
if ( bbp_is_single_forum() && ! empty( $display_forum_description ) ) {
echo '<div class="bbp-display-forum-description">';
echo $display_forum_description;
echo '</div>';
}
}
Okay, one more try now 🙂
There is one thing I want do do, so I have 2 questions according to that:
1.) (how) is it possible (I guess it is) to get WP userdata for display in bbpress? Lets say the First Name of the WordPress User Information.
Must be something get_userdata( <strong>bbpressuser</strong>) ?!
2.) As I learned, the Userinfos (Avatar, Role etc) of the Reply must be somewhere in loop-single-topic.php – but I really don´t find it.
Thanks in advance. Hope someone can help with that for the german forums (i´m from germany) are really dead :/
Best regards
Apokh
I found this solution :
add_action( 'bbp_template_before_single_forum' , 'xxxx_bbp_display_forum_description' );
function xxxx_bbp_display_forum_description() {
echo '<div>';
bbp_forum_content();
echo '</div>';
}
It’s a nice site; no worries about the ad, but I would be curious to see what that code does to an out of the box version of bbPress. It should get it pretty close; I just use a lot of ‘Inspect Element’ clicking to figure out what might be broken and tweak it. The main issue with bbPress and Pinboard is to do with the .onecol format, which for some reason is broken. Just an FYI, I’ve also modified the header.php file and the search.php file in Pinboard to move their built-in slider up to the utmost top of the page, so I can use it as a banner. It doesn’t quite work on my forums page, because that’s actually in a sub-category but in the blog section it slides. Just to explain why that may look different.
One other thing of note: in building my site I did a multisite install with three different instances of Pinboard running different sections. This allows me to keep the (1) Board, (2) Blog/Gear Reviews/Podcasts/Videos, and (3) Photoblog separate. The photoblog has like 1700 images so I didn’t want those mixed in with general purpose posts, and in order to make the board work with the CSS tweaks above, I had to set it up as a multisite so I could configure the other sections differently, get away from a one column layout, etc. The good news is in a multi-site the user carries their logged in status and identity from section to section regardless of which blog they’re in.
Zach
Hi Robin, thanks for this and sorry for not thanking you sooner – I completely forgot…..oops!! My coder is trying to sort this out for me but it really isnt a simple task. If anyone else out tehre has managed to do this, please let me know and if I manage it, I will post how here.
if the topic index shortcode would work in a widget, that would make me happy, I just tried it with a plugin, didn’t work so good
I’m trying to figure out a few things – I’ve done a search and read through a couple dozen or so items without much luck.
I’d like to incorporate some more info into the bbPress user profiles – I know I can probably do this using the $curauth params but want to make sure. I also want to make authors/contributors/etc link to the bbPress profiles as well. Is there a quick piece of code I can use to do this within my WordPress theme files?
I have this function to return an author profile page when the name is clicked on:
function new_comment_author_profile_link(){
/* Get the comment author information */
global $comment;
$comment_ID = $comment->user_id;
$author = get_comment_author( $comment_ID );
$url = get_comment_author_url( $comment_ID );
/* Return the default WordPress comment author link if comment author is not
a registered user */
if ($comment_ID == 0){
if ( empty( $url ) || 'http://' == $url )
$return = $author;
else
$return = "<a href='$url' rel='' class='author-url'>$author</a>";
} else {
/* Return the link to the comment author's profile page if otherwise */
$return = '<a href="'.home_url().'/?author='.$comment_ID.'">'.$author.'</a>';
}
return $return;
}
Can I plug in some line/piece of code to direct it to the bbPress profile instead? If so, what piece?
Wordpress & bbPress are latest versions – website is http://www.novasev.com
Appreciate the feedback.
I added the code and got an error message: Connection lost.
hmm seems the formatting for that code in 14 is not quite right
$bbp_roles['my_custom_role1'] = array(
'name' => 'name 1',
'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants
);
is => supposed to be => (just from other examples I’v seen in other posts)
it also spat errors at me with the extra empty lines between the lines of code.
Either way here is the code that works might be worth updating the codex thing
function add_custom_role( $bbp_roles ) {
$bbp_roles['my_custom_role1'] = array(
'name' => 'name 1',
'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participantsÂ
);
$bbp_roles['my_custom_role2'] = array(
'name' => 'name 2',
'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants
);
$bbp_roles['my_custom_role3'] = array(
'name' => 'name 3',
'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() ) // the same capabilities as keymasterÂ
);
return $bbp_roles;
}
add_filter( 'bbp_get_dynamic_roles', 'add_custom_role', 1 );
Thanks heaps for your help 🙂
Now to play around with this and the capabilities.
Try it with the return added !
function add_tiny() {
bbp_get_the_content(array (
'tinymce' => true,
));
Return $args ;
}
add_filter ('bbp_before_get_the_content_parse_args','add_tiny') ;
yes, go to
Layout and functionality – Examples you can use
and no. 15 if you want to change capabilities
Hi,
I recently installed bbpress on my site and had no issues with it – it worked really well. But I changed my permalinks to %category% for the category base. And suddenly the forums stopped working. I tried copying the short code, and even clicking “view forum” direct from the forum creator, and it keeps coming up as a 404, even though they are clearly visible in the back end.
When I remove the %category% permalink, it returns to normal, but then of course that stops me being able to permalink my categories (which is something I need to do for this site). I have tried un installing and re installing the plugin, but it doesn’t seem to have any effect. Any idea what might be going on, and how to resolve it?
I already tried this code but I had the same problem with this editor.
function add_tiny() {
bbp_get_the_content(array (
'tinymce' => true,
));
}
add_filter ('bbp_before_get_the_content_parse_args','add_tiny') ;
I think the problem is in the bbpress.php file. I will change same code on weekend and hope I will find the problem.
ok, I had a look, and yours is definitely trying to use the wp-editor not the tinymce one.
My forum calls
<div id="qt_bbp_topic_content_toolbar" class="quicktags-toolbar">
under the title.
Yours calls
<div id="wp-bbp_topic_content-editor-container" class="wp-editor-container">
As to why, I can’t say. You could try
function add_tiny() {
bbp_get_the_content(array (
'tinymce' => true,
));
}
add_filter ('bbp_before_get_the_content_parse_args','add_tiny') ;
in your functions file to force it to use the mce editor
(I haven’t tried that code so may need some editing)
The function in form-topic uses bbp_the_content which calls bbp_get-the_content – both functions are in
bbpress/includes/common/template.php
if you want a look.
I am now away for the weekend !
That will definitely cause you some grief. pre_get_posts is called on every posts query that fires, even non-bbPress ones.
In this case, you’re filtering every admin query and looking for a meta value that won’t exist for certain post types (like revisions, pages, posts, attachments, navigation menus, etc…)
You’ll want to target your code much more specifically than you are here, so that you’re only matching the correct query conditions for what you’re trying to accomplish. This might be hard if you’re also trying to filter sidebars and widgets, since you want something broad, but not too broad.
ok, got it.
I was sorting the topics by number of replies with this:
<?php
/*
Plugin Name: Set Post Order In Admin
Version: 0.1
Plugin URI: https://wordpress.org/support/topic/336715/
Description: In Posts->Edit, display posts in title order.
Author: MichaelH
Author URI: https://codex.wordpress.org/User:MichaelH/MyPlugins
*/
function set_post_order_in_admin( $wp_query ) {
if ( is_admin()) {
$wp_query->set( 'orderby', 'meta_value_num' );
$wp_query->set( 'meta_key', '_bbp_reply_count' );
$wp_query->set( 'order', 'DESC' );
}}
add_filter('pre_get_posts', 'set_post_order_in_admin' );
?>
this seems to cause the replies not to be deleted, too, curiously.`
Any idea why this happens? And how to delete the orphan replies + postmeta.
thanks, actually one of my forum members has been working on it as well, I had shown the wpengine desk his code and above is what they came up with, so he made a change and it works
here was his thoughts on it
The reason I asked if you still had an old version running was to check if there might be any variations to the old urls that we might want to process. But as long as people can get to the main threads, its better than them hitting 404s (not found).
So I tried it and it worked. A bit of redundancy in there, but its working. Very close to mine, not entirely sure where mine went wrong other than that I gobbled across a “/” to “-forum/”. I’m also puzzled by the .* instead of .+ I think his choice to leave off the end-of-line $ is interesting.
The redundancy I refer to is he captures garbage twice, then uses the 3rd capture. Would you humor me and try…
Source = ^/forum/.+/.+/(.+)-thread.+
Destination = /forums/topic/$1/
I did and it works well, so his might be a better option
The display name is currently a user choice. You could disable that by some code, but you would need to decide what to display instead eg username, email etc. But this is now completely opposite to your starting point to “allow users to choose a name and avatar before posting on a forum”.
Perhaps it would be easier if you described what it is that you would like to achieve and why in both profile and in the topic/reply display, rather than specific queries without any explanation.
I will try and assist you further
ok,
What I’d suggest you do is look in the main theme for a 404.php, and edit this to give a login link.
(If it doesn’t have a 404.php, then copy a page.php or index.php file across to your child theme and rename it 404.php. Look for the “loop” part of the code, and put the stuff in there instead)
You could then edit this file to have a link to your login and some different text.
So for instance if the 404.php files says “oops sorry this link appears to be broken”
you could amend this to :
This page cannot display. This maybe because you are not logged in. To login click here
or however your users login on.
They will probably go to the home page once logged in, so having the relevant posts in say the sidebar (eg latest topics widget) will let them quickly navigate to the post.
If any of the above not clear, please do come back.