I tried creating a plugin from the code above, but I couldn’t activate it. Can someone please help me with a step by step fix for a regular WP install?
Thanks for the code !
Pascal.
Hi Pascal,
Thanks for replying. It seems that the bbp_form_option() function is not available where I’m trying to get the value, but it’s basically a wrapper for get_option() so I can use that. Also, I was trying to grab the forum root slug, so the following has worked for me:
home_url(get_option( '_bbp_root_slug', 'forums' ));
Thanks for pointing me in the right direction.
Salut,
Marc
Can’t test here, but did you check echo bbp_form_option( '_bbp_forum_slug', 'forum', true ); ?
Here’s a filter that will redirect admins and editors to the admin panel after login.
add_filter('bbp_redirect_login', 'custom_bbp_redirect_login', 10, 3);
function custom_bbp_redirect_login($url, $raw_url, $user){
if ( !empty($user) && !empty($user->roles) && (in_array( 'administrator', (array)$user->roles ) || in_array( 'editor', (array)$user->roles )) ) {
return get_admin_url();
}
return $url;
}
@tech55541
If it works on PC, tablets etc. but doesn’t on a mobile, this will not be code functionality, but either JS or CSS.
Given that few mods will have the time to work out what this code is doing, let alone load it to their site, a URL to a page where it works on a PC but doesn’t on a mobile would be useful.
i want to show search bar on top of category page,
i pasted <?php echo do_shortcode(“[bbp-search-form]“); ?>
above shortcode in content-single-forum.php , i get search bar in category page but in sub forums page
i get 2 search bar..
I’m not, I am using a child theme of Twenty Twelve that I’ve been creating.
I actually got this figured out, on a whim I decided to try your $args[‘type’] = ‘list’; again and for whatever reason this time it worked. I don’t know if I may have just overlooked it the first time, or what.
My function:
function bbp_custom_pagination_links( $args ) {
$args['type'] = 'list';
return $args;
}
add_filter ('bbp_topic_pagination','bbp_custom_pagination_links');
I will still have to go through and do the same thing for other instances of pagination within bbPress, but that has worked for the topic list. It’s just a matter of styling the list elements with CSS at that point to get them aligned horizontally.
Thanks for all of your help, I really do appreciate it.
Right, clear as mud then 😉 But this does sound like this is the expected behaviour 🙂
Trivia: bbPress.org theme here shows both @username and “Display Name” because people used to try and ping me via @Stephen Edgar, rather than @netweb, hence we added both to the template loops 🙂
load my style pack, and you’ll find a shortcode to do just this
https://wordpress.org/plugins/bbp-style-pack/
ok after some poking and prodding and trying with filter, still no joy, but did find more information.
When I am not logged in and the role/link works, the class used is bbp-topic-author
When I am logged in and the link/role does not work the class is bbp-reply-author
I tried
function ShowRoles($args =array()){
$args['show_role'] = true;
return $args;
}
add_filter('bbp_before_get_reply_author_link_parse_args','ShowRoles');
but there is no change. It is almost like the css section is being suppressed all together.
Any insight?
2 tips:
– Install my bbP Toolkit
– Use the code below:
// Change freshness time by removing the last part, so '1 month, 3 days ago' becomes '1 month ago'
function casiepa_shorten_freshness_time($return) {
$return = preg_replace( '/, .*[^ago]/', ' ', $return );
return $return;
}
add_filter( 'bbp_get_time_since', 'casiepa_shorten_freshness_time' );
add_filter( 'bp_core_time_since', 'casiepa_shorten_freshness_time');
PS. Ben je niet op https://wpnl.slack.com ?
In loop-single-topic.php the following function is requested <?php bbp_topic_last_active_time();?> and this will display 2 weeks, 1 day ago I would like to only state the first part so 2 weeks ago and lose the specificity of it being a 1 day
There are different kinds of specificity depending on when the topics was last active like:
1 day, 23 hours ago
2 weeks, 1 day ago
1 month, 2 weeks ago
and I would like to convert them all to
1 day ago
2 weeks ago
1 month ago
Any tips on this would be highly appreciated.
Hello,
OK, was not all the way fixed, but I was able to get it there.
@media screen and (max-width:480px) {
.bbp-reply-author {
float: none !important;
clear: both;
margin-left: 0px !important;
}
}
Hello,
I guess it was the !important rule tripping me up, I tried restricting it to desktop devices only and that still did not fix it. I worked with WPMU DEV a little more to come up with this which has seemed to fix it. Why I do not know, all I know is that it is fixed now.
@media screen and (max-width:480px) {
.bbp-reply-author {
float: none;
clear: both;
}
}
Thanks.
The issue is on line 307 of sccss which says
.bbp-reply-content > p {
font-size: 14px;
margin-left: -37px !important;
}
The margin left is causing it to display incorrectly
Solved by replacing the bit I though wasn’t working with:
li.bbp-topic-title { width:50%; }
li.bbp-topic-voice-count, li.bbp-topic-voice-count {
text-align: center;
width: 30%;
}
li.bbp-topic-reply-count, li.bbp-topic-reply-count {
text-align: center;
width: 20%;
}
@casiepa, just wondering if you had a chance to look at my code.
Thanks
When I use bbpress I notice that on the mobile it is all squished up. To solve this I have removed the freshness column and adjusted the spacing of the info, topic and posts columns. This works on the forums page but when I click on one of the forums the freshness column is removed but the spacing seems to be the same. Can you see what I have done wrong with my css?
li.bbp-forum-freshness, li.bbp-forum-freshness {
display: none;
}
li.bbp-forum-freshness, li.bbp-topic-freshness {
display: none;
}
li.bbp-forum-info, li.bbp-topic-title { width:50%; }
li.bbp-forum-topic-count, li.bbp-forum-topic-count {
text-align: center;
width: 30%;
}
li.bbp-forum-reply-count, li.bbp-forum-reply-count {
text-align: center;
width: 20%;
}
////// This is the bit that isn't playing nice
li.bbp-forum-info, li.bbp-topic-title { width:50%; }
li.bbp-forum-topic-count, li.bbp-topic-topic-count {
text-align: center;
width: 30%;
}
li.bbp-forum-reply-count, li.bbp-topic-reply-count {
text-align: center;
width: 20%;
}
Many thanks 🙂
Hi,
bbPress translation files comes automatically and the ‘search’ button is in the translated list:
value="<?php esc_attr_e( 'Search', 'bbpress' ); ?>"
But I see you also have ‘topics’, ‘posts’ and ‘freshness’, so nothing is translated.
Can you please tell me:
1) in what language locale your WordPress is running in ?
Dashboard > Settings > General Settings > Site Language
2) What version of WordPress and bbPress you are using ?
Pascal.
I had the same error i did this piece of code and the status code will be force to be 200 in my case was when i was showing the user public profile.
function bbp_fix_users_404_headers() {
if (bp_displayed_user_id() != 0 && is_404() ) {
global $wp_query;
$wp_query->is_404 = false;
status_header( 200 );
}
}
add_action( 'wp', 'bbp_fix_users_404_headers',0 );
Ok thanks for the explanation. I guess it was too long so it was not going through.
Here is my looptopics.php code. I got the filtering to work correctly, except a big problem is that it ignores sticky posts. It does not even grab the sticky css class so I definitely did something wrong.
http://pastebin.com/u4Ci0kYK
Thanks for the help
If not too long, you can put it between backquotes.
So click the ‘code’ button (one but last button in the box where you type your reply), paste your code, then click that same button that will now be called ‘/code’
If it too long, paste it somewhere else like pastebin or github and just put a link.
Ok, this is a dumb question but how do I paste source code here?…