Hi,
I have just installed bbpress on my site, which is using the latest Twenty Fourteen child theme (only some simple css modifications.)
I want the forum listing page http://leopolds.com/discussions/ to look like this http://leopolds.com/bbs/ (created using shortcode).
There should be:
– No right-hand sidebar and centered content. I created a bbpress.php in my child theme folder and copied the full-width page template code to it. But it still looks different. Contents are not centered.
– No post-like forum listing. All forums I created are displayed under the usual forum listing section like posts.
Please help. Thank you very much.
That’s gud.
Actually i needed to add a shortcode along with some html customization just after the first post of the topic only.
How to do that?
nothing bad in doing that
as bbpress has different custom post types for topic and reply, you could also link to the action bbp_theme_after_reply_content action and put a topic condition on
something like
function display_after_topic() {
if( get_post_type() == 'topic') {
$text="hello mother" ;
echo $text;
}
else {
return ;
}
}
add_action ('bbp_theme_after_reply_content', 'display_after_topic') ;
I suspect this is not related, but always worth checking
Do you have a forums page with shortcode.
If not another poster did the following with success for a twentyfourteen theme.
So let me restate what you found to work:
1. When creating a menu item for forums, do NOT use the automatically available permalink that ends in “/forums/”
2. Instead, create a page that has the shortcode [bbp-forum-index] in the body. There could also then be other content or links in the body.
3. Make sure the page you created does NOT have a permalink that ends in “/forums/”. In my case I had a page Title of “Forums”, but I changed the permalink to end with “/allforums/”.
I suspect that this will not fix for you, but give it a try anyway !
I think I figured out how to make the toolbar appear. In my original theme, I didn’t include:
<?php wp_footer(); ?>
Apparently, that is what is needed to load all the javascripts to make the toolbar working. Hope this helps!
Terry
Ok.. so i found out a way to do it while checking the bbpress functions.
You can enable the bbpress show lead topic using this function
bbp_show_lead_topic
and then easily add any code to the content-single-topic-lead to display anything after the first post in a thread.
Is there bad side doing this?
Hi
I would like to insert a custom code or eco a shortcode after the first post in a topic. ( or say adsense after first posts)
I have tried to implement this – https://bbpress.org/forums/topic/displaying-adsense-ads/
But seems to be not working correctly.
When posting the code in loop-sing-reply, its getting showing below all replies.
Anyway to show only after the first posts.
Hope to get an help soon.
ok, you have several routes to go
If you think you will be making other changes, then it may be worth you reading this
Step by step guide to setting up a bbPress forum – part 2
but if you just want to get this going then download this plugin
https://wordpress.org/plugins/simple-custom-css/
and then put this code into it
#bbpress-forums .bbp-topic-content p,
#bbpress-forums .bbp-reply-content p {
color: blue !important ;
}
a:link {
color: blue !important ;
}
Obviously you can change the blue to whatever, or use hex codes to get any shade you like
http://www.w3schools.com/cssref/css_colors.asp
Come back if that doesn’t work, and I’ll try to help further
Hello,
I added the follwoing code to functions.php
add_action( ‘init’, ‘blockusers_init’ );
function blockusers_init() {
if ( is_admin() && ! current_user_can( ‘administrator’ ) &&
! ( defined( ‘DOING_AJAX’ ) && DOING_AJAX ) ) {
wp_redirect( bbp_user_profile_link( bbp_get_current_user_id() ) );
exit;
}
}
This redirects users to http://www.mydomainame.org/wp-admin/profile.php
and displays a link to their BBPress Profile.
Question is, how do I redirect users directly to to their BBPress profile?
This is probably something very simple, but I am not a developer unfortunately.
Thanks for your help.
I would not be entirely sure where to put the code lol.
ok if it proves an issue, you could use
if ( is_singular( array('forum', 'topic', 'reply') ) ) {
// conditional content/code
}
yes they are on your site.
If I gave you the code and said for you to add this to your style.css would you know what I was asking?
If so I’ll cut some for you to use
If not, come back and I’ll try and help further
Nevermind, Robin. It’s just a Notice and not an error at this point. I’m not going to stress over it at the moment. The code is working fine. Thanks for the help.
So I know people will facepalm at the question, but I am just really confused on this and I don’t wanna edit and mess the little bit of work I have done up lol. So anywho, how can I change the font color on the topics and posts? They are pretty difficult to see: http://i.imgur.com/8ZOOaef.png But yeah, I really dunno much (If anything) about code or website stuff so, surprised I got this far! Thanks for the help!
is_bbpress() almost works. Thanks for the pointer there, by the way. I can’t see how I missed that function in all my searching. I failed my Google-fu obviously. My code now looks like this in the my-plugin.php file.
function forum_lock_check($allcaps, $cap) {
if (function_exists("is_bbpress")) {
$is_bbpress = is_bbpress();
} else {
$is_bbpress = false;
}
return $allcaps;
}
add_filter("user_has_cap", "forum_lock_check", 10, 3);
Here’s the funny part. (Funny = weird not Funny = haha) If I’m navigating to the main forums page (http://localhost/wordpress/forums/), then everything proceeds swimmingly. If I then navigate to a forum within the page (http://localhost/wordpress/forums/forum.forum-a) or to a thread within the forum (http://localhost/wordpress/forums/topic/post-1) I then get several of the following errors.
Notice: Trying to get property of non-object in C:\xampp\htdocs\wordpress\wp-includes\query.php on line 3792
Notice: Undefined property: WP_Query::$post in C:\xampp\htdocs\wordpress\wp-includes\query.php on line 3306
Commenting out the “$is_ppbress = is_bbpress();” line removes the errors but I’ve got no idea why WordPress suddenly doesn’t like the code. Have you seen this before? What file is is_bbpress() in?
Thanks, Robin.
Hey Stephen, I’ve modified your code. With your code, when clicking on the link, it redirects the user to the compose form with the “Send To” field empty. I wanted to fill this field for the user automatically, just the way it works in buddypress user page. So I came up with this code.
function ntwb_bbp_bp_pm() {
if(function_exists('bp_send_private_message_link') && is_user_logged_in() ) {
$user = get_userdata( bbp_get_reply_author_id() );
if ( !empty( $user->user_nicename ) ) {
$user_nicename = $user->user_nicename;
}
$compose = bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . $user_nicename;
?>
<a>" title="Private Message">Private Message</a>
<?php
}
}
add_action( 'bbp_theme_after_reply_author_details', 'ntwb_bbp_bp_pm' );
I’m not a php programmer and I’m not sure that I did it the right way, but hey, it works.
you can edit the profile page to prevent them changing it
In your theme create a bbpress folder
wp-content/themes/%yourtheme%/bbpress
where %yourtheme% is the name of your theme
then navigate to
wp-content/plugins/bbpress/templates/default/bbpress/form-user-edit.php
and copy this file to the bbpress folder you created above
bbpress will now use this one instead of the default.
edit this new file and take out lines 33 to 45
ie take out the following
<div>
<label for="nickname"><?php _e( 'Nickname', 'bbpress' ); ?></label>
<input type="text" name="nickname" id="nickname" value="<?php bbp_displayed_user_field( 'nickname', 'edit' ); ?>" class="regular-text" tabindex="<?php bbp_tab_index(); ?>" />
</div>
<div>
<label for="display_name"><?php _e( 'Display Name', 'bbpress' ) ?></label>
<?php bbp_edit_user_display_name(); ?>
</div>
<?php do_action( 'bbp_user_edit_after_name' ); ?>
This will remove the ability to set a nickname and to change the display name.
is_bbpress()
should do it I think.
Otherwise bbpress has custom post types of forum, topic and reply.
You should also consider disabling or modifying the bbpress search function, as otherwise searches will go forum wide, giving a backdoor.
Good luck !
Hi,
Here’s my situation. I have a site with several forums. Let’s call them Forum A, B and C. All users to the site can view Forum A. Through other actions that happen on the site users collect points. At a certain point total Forum B becomes available. At another point total Forum C becomes available. There is an external webservice I can call to see if the user has the appropriate number of points for the relevant Forum.
As far as I can tell, bbPress doesn’t have the built in capability to handle that particular permissions scenario so I’m building a plugin. My plugin is hooking on the “user_has_cap” filter to determine whether a user can see a particular forum. I don’t want to make an external webservice call on every single current_user_can() call that gets made during a page load, so in my hook function I want to immediately check to see if the current request is a Forum page.
For example, if the requested page was “http://localhost/wordpress/forums/forum/forum-b/” then being able to get the pagename “forums” it would allow me to jump out of my hook function immediately if the request wasn’t for a forum page or topic. Below is a copy of code/pseudocode for what I’m doing in the plugin.
function forum_lock_check($allcaps, $cap) {
if (pagename != "forums") return $allcaps;
if (webservice says I can) {
$allcaps["can-view-forum"] = true;
}
return $allcaps;
}
add_filter("user_has_cap", "forum_lock_check", 10, 3);
Is there a wordpress or bbpress function that gives me the pagename the forum is attached to? Of course, if there is an easier way to do what I want, I’m all ears for that as well. Thanks for any help you can give me.
Hi @peterwsterling
I’m keen to get your plugin but I am also using WP Polls for blog posts and pages and in fact WP Polls can also embed in bbpress posts (https://wordpress.org/plugins/wp-polls/installation/) though Polls can only be created by Admins from the backend
WP Polls also uses the short code poll but in a different format
[poll id="2" type="result"]
But I like the concept of users being able to create their own polls in forum posts so I’d be keen to get your plugin provided it doesn’t conflict with WP Polls. Hope you can confirm.
Thanks
You should really be looking to get rid of the toolbar for everyone but moderators and above ! It shouldn’t really be seen by users.
go to dashboard>users and for each user untick the toolbar
The codex has help on putting logins and profile on the menu pages – see
https://codex.bbpress.org/layout-and-functionality-examples-you-can-use/ no.s 8 & 11/12
Hello Liberty and all the experts here,
I am having the same problem. I set up the bbpress using a minimalist theme I created from scratch. Everything works except the missing toolbar in the editor.
I added the following code in the functions.php file, but I only saw two tabs “Visual” and “Text”, but no toolbar, as shown in the picture posted above by “Liberty.”
function bbp_enable_visual_editor( $args = array() ) {
$args['tinymce'] = true;
return $args;
}
add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );
When I switched to the Twenty Ten theme, the toolbar showed up nicely. I know my theme is missing something, but can’t seem to be able to figure out what I am missing. Any help will be greatly appreciated!!!
Have a great day!
Terry
I’ve submitted a trac ticket to improve the code !